Class: Popper::AccountAttributes

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/popper/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = nil) ⇒ AccountAttributes

Returns a new instance of AccountAttributes.



44
45
46
47
48
49
50
51
52
# File 'lib/popper/config.rb', line 44

def initialize(hash=nil)
  @table = {}
  @hash = hash

  hash.each do |k,v|
    @table[k.to_sym] = (v.is_a?(Hash) ? self.class.new(v) : v)
    new_ostruct_member(k)
  end if hash
end

Instance Method Details

#rule_by_name(name) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/popper/config.rb', line 94

def rule_by_name(name)
  begin
    @hash["rules"][name]
  rescue
    {}
  end
end

#to_hObject



54
55
56
# File 'lib/popper/config.rb', line 54

def to_h
  @hash
end