Class: Activite::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/activite/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Activite::Base

Initializes a new object with attributes for the values passed to the constructor.

Parameters:

  • attrs (Hash) (defaults to: {})

10
11
12
13
14
15
16
# File 'lib/activite/base.rb', line 10

def initialize(attrs = {})
  @attrs = attrs || {}
  @attrs.each do |key, value|
    self.class.class_eval { attr_reader key }
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#attrsHash (readonly)

Returns:

  • (Hash)

4
5
6
# File 'lib/activite/base.rb', line 4

def attrs
  @attrs
end