Module: Vnetwork::Core::Hashable

Included in:
Credential
Defined in:
lib/vnetwork/core/hashable.rb

Instance Method Summary collapse

Instance Method Details

#set_instance_variables(params) ⇒ Hash

Perform set instance variables for [Reprodue]

Parameters:

  • params (Hash)

    can be any hash data response, options, etc...

Returns:

  • (Hash)


21
22
23
24
25
26
27
28
29
# File 'lib/vnetwork/core/hashable.rb', line 21

def set_instance_variables(params)
  params.each do |key, value|
    instance_variable_set("@#{key}", value)

    instance_variables.each do |var|
      self.class.send(:attr_accessor, var.to_s.delete('@'))
    end
  end
end