Class: Ghtk::FlexibleParams

Inherits:
Object
  • Object
show all
Defined in:
lib/ghtk/flexible_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ FlexibleParams

Returns a new instance of FlexibleParams.



6
7
8
9
10
11
12
13
14
15
# File 'lib/ghtk/flexible_params.rb', line 6

def initialize(object)
  if object.is_a?(Hash)
    data = object
  elsif object.respond_to?(:as_json)
    data = object.as_json
  else
    data = object.attributes
  end
  @hash = data.to_deep_symbolize_keys
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



4
5
6
# File 'lib/ghtk/flexible_params.rb', line 4

def hash
  @hash
end