Module: Decanter::Extensions::ClassMethods

Defined in:
lib/decanter/extensions.rb

Instance Method Summary collapse

Instance Method Details

#decant(args, options) ⇒ Object



34
35
36
37
# File 'lib/decanter/extensions.rb', line 34

def decant(args, options)
  options.fetch(:decanter, Decanter.decanter_for(self))
    .decant(args)
end

#decant_create(args, **options) ⇒ Object



20
21
22
23
# File 'lib/decanter/extensions.rb', line 20

def decant_create(args, **options)
  self.new(decant(args, options))
      .save(context: options[:context])
end

#decant_create!(args, **options) ⇒ Object



29
30
31
32
# File 'lib/decanter/extensions.rb', line 29

def decant_create!(args, **options)
  self.new(decant(args, options))
      .save!(context: options[:context])
end

#decant_new(args, **options) ⇒ Object



25
26
27
# File 'lib/decanter/extensions.rb', line 25

def decant_new(args, **options)
  self.new(decant(args, options))
end