Module: Serega::Convert::ConvertInstanceMethods

Included in:
Serega::Convert
Defined in:
lib/serega/convert.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



12
13
14
# File 'lib/serega/convert.rb', line 12

def object
  @object
end

#optsObject (readonly)

Returns the value of attribute opts.



12
13
14
# File 'lib/serega/convert.rb', line 12

def opts
  @opts
end

Instance Method Details

#initialize(object, **opts) ⇒ Object



14
15
16
17
# File 'lib/serega/convert.rb', line 14

def initialize(object, **opts)
  @object = object
  @opts = opts
end

#to_hObject



19
20
21
# File 'lib/serega/convert.rb', line 19

def to_h
  many? ? many(object) : one(object) || {}
end