module Decanter::Extensions::ClassMethods

Public Instance Methods

decant(args, options = {}) click to toggle source
# File lib/decanter/extensions.rb, line 36
def decant(args, options = {})
  if (specified_decanter = options[:decanter])
    Decanter.decanter_from(specified_decanter)
  else
    Decanter.decanter_for(self)
  end.decant(args)
end
decant_create(args, **options) click to toggle source
# File lib/decanter/extensions.rb, line 22
def decant_create(args, **options)
  self.new(decant(args, options))
      .save(context: options[:context])
end
decant_create!(args, **options) click to toggle source
# File lib/decanter/extensions.rb, line 31
def decant_create!(args, **options)
  self.new(decant(args, options))
      .save!(context: options[:context])
end
decant_new(args, **options) click to toggle source
# File lib/decanter/extensions.rb, line 27
def decant_new(args, **options)
  self.new(decant(args, options))
end