Method: DataMapper::Model::Property#properties

Defined in:
lib/dm-core/model/property.rb

#properties(repository_name = default_repository_name) ⇒ PropertySet

Gets a list of all properties that have been defined on this Model in the requested repository

Parameters:

  • repository_name (Symbol, String) (defaults to: default_repository_name)

    The name of the repository to use. Uses the default Repository if none is specified.

Returns:

  • (PropertySet)

    A list of Properties defined on this Model in the given Repository



116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/dm-core/model/property.rb', line 116

def properties(repository_name = default_repository_name)
  # TODO: create PropertySet#copy that will copy the properties, but assign the
  # new Relationship objects to a supplied repository and model.  dup does not really
  # do what is needed
  repository_name = repository_name.to_sym

  default_repository_name = self.default_repository_name

  @properties[repository_name] ||= if repository_name == default_repository_name
    PropertySet.new
  else
    properties(default_repository_name).dup
  end
end