Sha256: 0645944e9b0e91fa28165155591c7ececaa6ecbd9d10493ce3a698df49c45210

Contents?: true

Size: 291 Bytes

Versions: 2

Compression:

Stored size: 291 Bytes

Contents

require "hash_with_key_access_method/version"

module HashWithKeyAccessMethod
	def method_missing name, *args
		if name =~ /=$/
			self[name[0..-2].to_sym] = args[0]
		else
			super unless has_key?(name)
			self[name]
		end
	end

	refine Hash do
		prepend ::HashWithKeyAccessMethod
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hash_with_key_access_method-0.0.2 lib/hash_with_key_access_method.rb
hash_with_key_access_method-0.0.1 lib/hash_with_key_access_method.rb