Module: HashConstructed

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



6
7
8
# File 'lib/logan/HashConstructed.rb', line 6

def attributes
  @attributes
end

#json_rawObject

Returns the value of attribute json_raw.



6
7
8
# File 'lib/logan/HashConstructed.rb', line 6

def json_raw
  @json_raw
end

Instance Method Details

#initialize(h) ⇒ Object

initalizes the object by pulling key-value pairs from the hash and mapping them to the object’s instance variables

Parameters:

  • h (Hash)

    hash containing key-value pairs to map to object instance variables



12
13
14
15
16
17
18
# File 'lib/logan/HashConstructed.rb', line 12

def initialize(h)
  @attributes = h
  h.each do |k,v|
    next unless respond_to?("#{k}=")
    send("#{k}=",v)
  end
end