Class: Subscriber::Event

Inherits:
Object
  • Object
show all
Defined in:
app/support/subscriber.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Event

Returns a new instance of Event.



4
5
6
7
8
9
10
# File 'app/support/subscriber.rb', line 4

def initialize(hash)
  hash.each do |k,v|
    self.instance_variable_set("@#{k}", v)  ## create and initialize an instance variable for this key/value pair
    self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")})  ## create the getter that returns the instance variable
    self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)})  ## create the setter that sets the instance variable
  end
end