Class: Date::Format::Bag
- Inherits:
-
Object
- Object
- Date::Format::Bag
- Defined in:
- lib/date/format.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize ⇒ Bag
constructor
A new instance of Bag.
- #method_missing(t, *args, &block) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ Bag
Returns a new instance of Bag.
99 100 101 |
# File 'lib/date/format.rb', line 99 def initialize @elem = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(t, *args, &block) ⇒ Object
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/date/format.rb', line 103 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_hash ⇒ Object
114 115 116 |
# File 'lib/date/format.rb', line 114 def to_hash @elem.reject{|k, v| /\A_/ =~ k.to_s || v.nil?} end |