lib/dm-is-predefined/is/predefined.rb
#
# Defines a new pre-defined resource for the model.
#
# @param [Symbol, String] name
#   The name of the pre-defined resource.
#
# @param [Hash] attributes
#   The attributes for the pre-defined resource.
#
# @return [Hash]
#   The attributes that will be assigned to the pre-defined
#   resource.
#
# @api public
#
Defines a new pre-defined resource for the model.
Defines a new pre - defined resource for the model .
def predefine(name,attributes={})
          name = name.to_sym
          if attributes.empty?
            raise(ArgumentError,"Cannot predefine a resource with no attributes")
          end
          predefined_attributes[name] = attributes
          class_eval %{
            class << self
              define_method(#{name.inspect}) do
                predefined_resource(#{name.inspect})
              end
            end
          }
          return attributes
        end
def predefine ( name , attributes = { } ) name = name . to_sym if attributes . empty? raise ( ArgumentError , "Cannot predefine a resource with no attributes" ) end predefined_attributes [ name ] = attributes class_eval %{
            class << self
              define_method(#{name.inspect}) do
                predefined_resource(#{name.inspect})
              end
            end
          } return attributes end
Defines a new pre-defined resource for the model.
Defines a new pre - defined resource for the model .
The attributes that will be assigned to the pre-defined resource.
The attributes that will be assigned to the pre - defined resource .
Hash
name
<not_specific>
attributes
<not_specific>
<not_specific>
attributes The attributes for the pre-defined resource.
attributes The attributes for the pre - defined resource .
api
None