Class: Juvet::Mapper::Collection
- Inherits:
-
Object
- Object
- Juvet::Mapper::Collection
- Defined in:
- lib/juvet/mapper/collection.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #entity(klass = nil) ⇒ Object
-
#initialize(name, &block) ⇒ Collection
constructor
A new instance of Collection.
- #repository(klass = nil, options = nil) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Collection
Returns a new instance of Collection.
8 9 10 11 |
# File 'lib/juvet/mapper/collection.rb', line 8 def initialize(name, &block) @name = name instance_eval(&block) if block_given? end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/juvet/mapper/collection.rb', line 6 def name @name end |
Instance Method Details
#entity(klass = nil) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/juvet/mapper/collection.rb', line 13 def entity(klass=nil) if klass @entity = klass else @entity end end |
#repository(klass = nil, options = nil) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/juvet/mapper/collection.rb', line 21 def repository(klass=nil, =nil) if klass @repository = MappedRepository.new klass, else @repository end end |