Class: Depository::CollectionConfig
- Inherits:
-
Object
- Object
- Depository::CollectionConfig
- Defined in:
- lib/depository/collection_config.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#packer ⇒ Object
17 18 19 |
# File 'lib/depository/collection_config.rb', line 17 def packer @packer ||= identity end |
#unpacker ⇒ Object
21 22 23 |
# File 'lib/depository/collection_config.rb', line 21 def unpacker @unpacker ||= identity end |
Instance Method Details
#db(&block) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/depository/collection_config.rb', line 25 def db(&block) if block_given? @_db_block = block @_db = nil else value = @_db_block.call @_db ||= value.is_a?(Symbol) ? Database[value] : value end end |
#model(&block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/depository/collection_config.rb', line 9 def model(&block) if block_given? self._model_block = block else @_model ||= _model_block.call end end |
#primary_key(value = nil) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/depository/collection_config.rb', line 35 def primary_key(value = nil) if value @_primary_key = value else @_primary_key ||= :id end end |