Class: UniqSysOmega::Tariffs::Settings::Proxy
- Inherits:
-
Object
- Object
- UniqSysOmega::Tariffs::Settings::Proxy
- Defined in:
- lib/settings.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(hash) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(meth, *args) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(hash) ⇒ Proxy
Returns a new instance of Proxy.
19 20 21 22 |
# File 'lib/settings.rb', line 19 def initialize(hash) raise ArgumentError, "Invalid argument for settings. Should be hash." unless hash.kind_of?(Hash) @hash = HashWithIndifferentAccess.new(hash) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Method Details
#==(other) ⇒ Object
34 35 36 37 |
# File 'lib/settings.rb', line 34 def ==(other) raise "Invalid comparison" unless other.kind_of?(Hash) || other.kind_of?(Settings::Proxy) || other.kind_of?(Settings) @hash == HashWithIndifferentAccess.new(other.to_hash) end |
#to_hash ⇒ Object
30 31 32 |
# File 'lib/settings.rb', line 30 def to_hash @hash.dup end |