Class: Fixjour::OverridesHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/fixjour/overrides_hash.rb

Overview

The overrides hash passed into each of the Fixjour methods is wrapped in this class to make the delete method private and add the ability to process.

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ OverridesHash

Returns a new instance of OverridesHash.



8
9
10
# File 'lib/fixjour/overrides_hash.rb', line 8

def initialize(hash)
  replace(hash)
end

Instance Method Details

#process(option) ⇒ Object

Allows for processing of the overrides hash. Deletes the option when it’s present, then yields the value.



14
15
16
17
18
# File 'lib/fixjour/overrides_hash.rb', line 14

def process(option)
  delete(option).tap do |value|
    yield value if value and block_given?
  end
end