Class: RubyRedtail::Setting

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-redtail/setting.rb

Instance Method Summary collapse

Constructor Details

#initialize(setting = {}, api_hash) ⇒ Setting

Returns a new instance of Setting.

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
11
12
# File 'lib/ruby-redtail/setting.rb', line 3

def initialize(setting = {},api_hash)
  @api_hash = api_hash
  
  raise ArgumentError if setting.class != Hash
  setting.each do |key, value|
    key = key.underscore
    self.class.send :attr_accessor, key
    instance_variable_set "@#{key}", value
  end
end