Sha256: ddaac42d250dbb905ac68c00481e552e421b053a4e0d3cb0c2572c7727e8d185

Contents?: true

Size: 262 Bytes

Versions: 5

Compression:

Stored size: 262 Bytes

Contents

class Hash
  
  # Allows using hash.key as a synonym for hash[:key] and
  # hash['key']
  def method_missing(name, *args, &block)
    if args.empty? and block.nil?
      self[name] || self[name.to_s]
    else
      super(name, *args, &block)
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wlang-0.10.2 lib/wlang/ext/hash_methodize.rb
wlang-0.10.1 ./lib/wlang/ext/hash_methodize.rb
wlang-0.10.0 lib/wlang/ext/hash_methodize.rb
wlang-0.9.2 lib/wlang/ext/hash_methodize.rb
wlang-0.9.1 lib/wlang/ext/hash_methodize.rb