Module: LunaPark::Extensions::DataMapper::ClassMethods
- Defined in:
- lib/luna_park/extensions/data_mapper.rb
Constant Summary collapse
- DEFAULT_PRIMARY_KEY =
:id
Instance Attribute Summary collapse
-
#entity_class ⇒ Object
readonly
Returns the value of attribute entity_class.
-
#mapper_class ⇒ Object
readonly
Returns the value of attribute mapper_class.
Instance Method Summary collapse
- #db_primary_key ⇒ Object
-
#entity(entity_class = nil) ⇒ Object
Configure repository.
- #mapper(mapper_class = nil) ⇒ Object
- #primary_key(pk = nil) ⇒ Object
Instance Attribute Details
#entity_class ⇒ Object (readonly)
Returns the value of attribute entity_class.
45 46 47 |
# File 'lib/luna_park/extensions/data_mapper.rb', line 45 def entity_class @entity_class end |
#mapper_class ⇒ Object (readonly)
Returns the value of attribute mapper_class.
45 46 47 |
# File 'lib/luna_park/extensions/data_mapper.rb', line 45 def mapper_class @mapper_class end |
Instance Method Details
#db_primary_key ⇒ Object
63 64 65 |
# File 'lib/luna_park/extensions/data_mapper.rb', line 63 def db_primary_key @db_primary_key || DEFAULT_PRIMARY_KEY end |
#entity(entity_class = nil) ⇒ Object
Configure repository
49 50 51 |
# File 'lib/luna_park/extensions/data_mapper.rb', line 49 def entity(entity_class = nil) @entity_class = entity_class end |
#mapper(mapper_class = nil) ⇒ Object
53 54 55 |
# File 'lib/luna_park/extensions/data_mapper.rb', line 53 def mapper(mapper_class = nil) @mapper_class = mapper_class end |
#primary_key(pk = nil) ⇒ Object
59 60 61 |
# File 'lib/luna_park/extensions/data_mapper.rb', line 59 def primary_key(pk = nil) @db_primary_key = pk end |