Class: Orthrus::RemoteOptions
- Inherits:
-
Hash
- Object
- Hash
- Orthrus::RemoteOptions
- Defined in:
- lib/orthrus/remote_options.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ RemoteOptions
constructor
A new instance of RemoteOptions.
-
#smart_merge(hash) ⇒ nil, RemoteOptions
Merge the given hash and its subhashes.
-
#smart_merge!(other_hash) ⇒ Object
Perform smart merge and replace the current content.
Constructor Details
#initialize(options = {}) ⇒ RemoteOptions
Returns a new instance of RemoteOptions.
4 5 6 |
# File 'lib/orthrus/remote_options.rb', line 4 def initialize( = {}) replace() end |
Instance Method Details
#smart_merge(hash) ⇒ nil, RemoteOptions
Merge the given hash and its subhashes.
11 12 13 14 15 16 |
# File 'lib/orthrus/remote_options.rb', line 11 def smart_merge(hash) return self if hash.nil? merge(hash) do |key, o, n| o.is_a?(Hash) && n.is_a?(Hash) ? o.merge(n) : n end end |
#smart_merge!(other_hash) ⇒ Object
Perform smart merge and replace the current content
20 21 22 |
# File 'lib/orthrus/remote_options.rb', line 20 def smart_merge!(other_hash) replace(smart_merge(other_hash)) end |