Class: AbAdmin::Models::Settings::SettingsStruct

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/ab_admin/models/settings.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = nil) ⇒ SettingsStruct

Returns a new instance of SettingsStruct.



61
62
63
64
65
66
67
68
# File 'lib/ab_admin/models/settings.rb', line 61

def initialize(hash=nil)
  @table = {}
  return unless hash
  hash.symbolize_keys.each do |k, v|
    k = k.to_sym
    @table[k] = v.is_a?(Hash) ? SettingsStruct.new(v.symbolize_keys) : v
  end
end

Instance Method Details

#get(key) ⇒ Object



70
71
72
# File 'lib/ab_admin/models/settings.rb', line 70

def get(key)
  dig *key.split('.').map(&:to_sym)
end