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
53
54
# File 'lib/popper/config.rb', line 44

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

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

Instance Method Details

#rule_by_name(name) ⇒ Object



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

def rule_by_name(name)
  @hash['rules'][name]
rescue StandardError
  {}
end

#to_hObject



56
57
58
# File 'lib/popper/config.rb', line 56

def to_h
  @hash
end