Class: Date::Format::Bag
- Inherits:
-
Object
- Object
- Date::Format::Bag
- Defined in:
- lib/project/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
-
#zone ⇒ Object
XXX this is required in MacRuby otherwise it conflicts with NSObject#zone.
- #zone=(z) ⇒ Object
Constructor Details
#initialize ⇒ Bag
Returns a new instance of Bag.
114 115 116 |
# File 'lib/project/format.rb', line 114 def initialize @elem = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(t, *args, &block) ⇒ Object
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/project/format.rb', line 118 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
129 130 131 |
# File 'lib/project/format.rb', line 129 def to_hash @elem.reject{|k, v| /\A_/ =~ k.to_s || v.nil?} end |
#zone ⇒ Object
XXX this is required in MacRuby otherwise it conflicts with NSObject#zone
134 |
# File 'lib/project/format.rb', line 134 def zone; @elem[:zone]; end |
#zone=(z) ⇒ Object
135 |
# File 'lib/project/format.rb', line 135 def zone=(z); @elem[:zone]=z; end |