lib/dm-is-predefined/is/predefined.rb
#
# Finds or auto-creates the pre-defined resource with the given
# name.
#
# @param [Symbol, String] name
#   The name of the pre-defined resource.
#
# @return [DataMapper::Resource]
#   The pre-defined resource.
#
# @raise [UnknownResource]
#   Indicates that there are no predefined attributes for the
#   resource with the given name.
#
# @since 0.2.1
#
# @api public
#
Finds or auto-creates the pre-defined resource with the given
name.
Finds or auto - creates the pre - defined resource with the given name .
def predefined_resource(name)
          name = name.to_sym
          unless predefined?(name)
            raise(UnknownResource,"The resource '#{name}' was not predefined")
          end
          return first_or_create(predefined_attributes[name])
        end
def predefined_resource ( name ) name = name . to_sym unless predefined? ( name ) raise ( UnknownResource , "The resource '#{name}' was not predefined" ) end return first_or_create ( predefined_attributes [ name ] ) end
Finds or auto-creates the pre-defined resource with the given
name.
Finds or auto - creates the pre - defined resource with the given name .
The pre-defined resource.
The pre - defined resource .
DataMapper::Resource
[UnknownResource] Indicates that there are no predefined attributes for the resource with the given name.
[ UnknownResource ] Indicates that there are no predefined attributes for the resource with the given name .
name
<not_specific>
<not_specific>
name The name of the pre-defined resource.
name The name of the pre - defined resource .
since
None
api
None