Module: Decanter::Extensions::ClassMethods
- Defined in:
- lib/decanter/extensions.rb
Instance Method Summary collapse
- #decant(args, options = {}) ⇒ Object
- #decant_create(args, **options) ⇒ Object
- #decant_create!(args, **options) ⇒ Object
- #decant_new(args, **options) ⇒ Object
Instance Method Details
#decant(args, options = {}) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/decanter/extensions.rb', line 36 def decant(args, = {}) if (specified_decanter = [:decanter]) Decanter.decanter_from(specified_decanter) else Decanter.decanter_for(self) end.decant(args) end |
#decant_create(args, **options) ⇒ Object
22 23 24 25 |
# File 'lib/decanter/extensions.rb', line 22 def decant_create(args, **) self.new(decant(args, )) .save(context: [:context]) end |
#decant_create!(args, **options) ⇒ Object
31 32 33 34 |
# File 'lib/decanter/extensions.rb', line 31 def decant_create!(args, **) self.new(decant(args, )) .save!(context: [:context]) end |
#decant_new(args, **options) ⇒ Object
27 28 29 |
# File 'lib/decanter/extensions.rb', line 27 def decant_new(args, **) self.new(decant(args, )) end |