Sha256: 7d22ff64d946f5da368bc6cebeaf0da947ca6d7287d97c6b49b1a73a64f3d503

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

###########################################################
###########################################################
##                _   _           _                      ##
##               | | | |         | |                     ##
##               | |_| | __ _ ___| |__                   ##
##               |  _  |/ _` / __| '_ \                  ##
##               | | | | (_| \__ \ | | |                 ##
##               \_| |_/\__,_|___/_| |_|                 ##
##                                                       ##
###########################################################
###########################################################

## Used to traverse nested pairs (hashes) ##

###########################################################
###########################################################

## Extends Hash class ##
class Hash

  def each_nested_pair
    self.each_pair do |k,v|
      if v.is_a?(Hash)
        v.each_nested_pair {|k2,v2| yield "#{k}-#{k2}",v2} #-> RECURSION!!
      else
        yield(k,v)
      end
    end
  end

end

###########################################################
###########################################################

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fl-0.3.9 lib/fl/hash.rb
fl-0.3.8 lib/fl/hash.rb
fl-0.3.6 lib/fl/hash.rb
fl-0.3.5 lib/fl/hash.rb
fl-0.3.4 lib/fl/hash.rb
fl-0.3.3 lib/fl/hash.rb
fl-0.3.2 lib/fl/hash.rb
fl-0.3.1 lib/fl/hash.rb
fl-0.3.0 lib/fl/hash.rb