Module: HashConstructed

Included in:
Logan::Event, Logan::Person, Logan::Project, Logan::Todo, Logan::TodoList
Defined in:
lib/logan/HashConstructed.rb

Overview

Instance Method Summary collapse

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



10
11
12
# File 'lib/logan/HashConstructed.rb', line 10

def initialize(h)
  h.each { |k,v| send("#{k}=",v) if respond_to?("#{k}=") } 
end