Class: BillForward::OrderedHashWithDotAccess

Inherits:
ActiveSupport::OrderedHash
  • Object
show all
Defined in:
lib/bill_forward/custom_hash.rb

Overview

Note: does not use indifferent access! Only entities themselves have indifferent access!

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_id, *arguments, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/bill_forward/custom_hash.rb', line 4

def method_missing(method_id, *arguments, &block)
	# no call to super; our criteria is all keys.
	#setter
	if /^(\w+)=$/ =~ method_id.to_s
		return self[$1] = arguments.first
	end
	#getter
	self[method_id.to_s]
end