Module: ActiveEncode::Core::ClassMethods

Defined in:
lib/active_encode/core.rb

Instance Method Summary collapse

Instance Method Details

#create(input, options = nil) ⇒ Object



27
28
29
30
# File 'lib/active_encode/core.rb', line 27

def create(input, options = nil)
  object = new(input, options)
  object.create!
end

#default_options(_input) ⇒ Object



23
24
25
# File 'lib/active_encode/core.rb', line 23

def default_options(_input)
  {}
end

#find(id) ⇒ Object

Raises:

  • (ArgumentError)


32
33
34
35
# File 'lib/active_encode/core.rb', line 32

def find(id)
  raise ArgumentError, 'id cannot be nil' unless id
  engine_adapter.find(id, cast: self)
end