Sha256: 277d96805a5d601653a5105f42ed03845ffb6b8e58a02bc1129bd2ac5c926668

Contents?: true

Size: 207 Bytes

Versions: 2

Compression:

Stored size: 207 Bytes

Contents

class Hash
  # Convert Hash into a Proc that takes a key and returns the value of the Hash for that key.
  #
  # @return [Proc]
  def to_proc
    lambda do |k, *_|
      self.fetch(k, nil)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
data-functions-0.1.1 lib/data/functions/hash.rb
data-functions-0.1.0 lib/data/functions/hash.rb