Module: Sec::Firms::Helpers

Defined in:
lib/sec/firms/helpers.rb

Class Method Summary collapse

Class Method Details

.transform_hash(original, options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/sec/firms/helpers.rb', line 4

def self.transform_hash(original, options = {}, &block)
  original.inject({}) do |result, (key, value)|
    value = if (options[:deep] && Hash === value)
              transform_hash(value, options, &block)
            else
              value
            end
    block.call(result, key, value)
    result
  end
end