Class: Date::Format::Bag

Inherits:
Object show all
Defined in:
lib/framework/date/format.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeBag

Returns a new instance of Bag.



115
116
117
# File 'lib/framework/date/format.rb', line 115

def initialize
	@elem = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(t, *args, &block) ⇒ Object



119
120
121
122
123
124
125
126
127
128
# File 'lib/framework/date/format.rb', line 119

def method_missing(t, *args, &block)
	t = t.to_s
	set = t.chomp!('=')
	t = t.intern
	if set
	  @elem[t] = args[0]
	else
	  @elem[t]
	end
end

Instance Method Details

#to_hashObject



130
131
132
# File 'lib/framework/date/format.rb', line 130

def to_hash
	@elem.reject{|k, v| /\A_/ =~ k.to_s || v.nil?}
end