Module: Decanter::Extensions

Defined in:
lib/decanter/extensions.rb

Defined Under Namespace

Modules: ActiveRecordExtensions, ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/decanter/extensions.rb', line 5

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#decant(args, **options) ⇒ Object



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

def decant(args, **options)
  self.class.decant(args, options)
end

#decant_update(args, **options) ⇒ Object



9
10
11
12
# File 'lib/decanter/extensions.rb', line 9

def decant_update(args, **options)
  self.attributes = self.class.decant(args, options)
  save(context: options[:context])
end

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



14
15
16
17
# File 'lib/decanter/extensions.rb', line 14

def decant_update!(args, **options)
  self.attributes = self.class.decant(args, options)
  save!(context: options[:context])
end