Class: AbAdmin::Models::Settings::SettingsStruct
- Defined in:
- lib/ab_admin/models/settings.rb
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize(hash = nil) ⇒ SettingsStruct
constructor
A new instance of SettingsStruct.
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 |