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) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Collection
Returns a new instance of Collection.
6 7 8 9 |
# File 'lib/juvet/mapper/collection.rb', line 6 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.
4 5 6 |
# File 'lib/juvet/mapper/collection.rb', line 4 def name @name end |
Instance Method Details
#entity(klass = nil) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/juvet/mapper/collection.rb', line 11 def entity(klass=nil) if klass @entity = klass else @entity end end |
#repository(klass = nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/juvet/mapper/collection.rb', line 19 def repository(klass=nil) if klass @repository = klass else @repository end end |