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
38 39 40 41 42 43 44 |
# File 'lib/decanter/extensions.rb', line 38 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
24 25 26 27 |
# File 'lib/decanter/extensions.rb', line 24 def decant_create(args, **) self.new(decant(args, )) .save(context: [:context]) end |
#decant_create!(args, **options) ⇒ Object
33 34 35 36 |
# File 'lib/decanter/extensions.rb', line 33 def decant_create!(args, **) self.new(decant(args, )) .save!(context: [:context]) end |
#decant_new(args, **options) ⇒ Object
29 30 31 |
# File 'lib/decanter/extensions.rb', line 29 def decant_new(args, **) self.new(decant(args, )) end |