Class: Mack::Request::DateTimeParameter
- Defined in:
- lib/mack/controller/request.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#day ⇒ Object
Returns the value of attribute day.
-
#hour ⇒ Object
Returns the value of attribute hour.
-
#minute ⇒ Object
Returns the value of attribute minute.
-
#month ⇒ Object
Returns the value of attribute month.
-
#second ⇒ Object
Returns the value of attribute second.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
- #add(key, value) ⇒ Object
-
#initialize ⇒ DateTimeParameter
constructor
A new instance of DateTimeParameter.
- #to_s ⇒ Object
- #to_time ⇒ Object
Constructor Details
#initialize ⇒ DateTimeParameter
Returns a new instance of DateTimeParameter.
159 160 161 162 163 164 165 166 |
# File 'lib/mack/controller/request.rb', line 159 def initialize self.year = Time.now.year self.month = 1 self.day = 1 self.hour = 0 self.minute = 0 self.second = 0 end |
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day.
154 155 156 |
# File 'lib/mack/controller/request.rb', line 154 def day @day end |
#hour ⇒ Object
Returns the value of attribute hour.
155 156 157 |
# File 'lib/mack/controller/request.rb', line 155 def hour @hour end |
#minute ⇒ Object
Returns the value of attribute minute.
156 157 158 |
# File 'lib/mack/controller/request.rb', line 156 def minute @minute end |
#month ⇒ Object
Returns the value of attribute month.
153 154 155 |
# File 'lib/mack/controller/request.rb', line 153 def month @month end |
#second ⇒ Object
Returns the value of attribute second.
157 158 159 |
# File 'lib/mack/controller/request.rb', line 157 def second @second end |
#year ⇒ Object
Returns the value of attribute year.
152 153 154 |
# File 'lib/mack/controller/request.rb', line 152 def year @year end |
Instance Method Details
#add(key, value) ⇒ Object
168 169 170 |
# File 'lib/mack/controller/request.rb', line 168 def add(key, value) self.send("#{key}=", value) end |
#to_s ⇒ Object
172 173 174 |
# File 'lib/mack/controller/request.rb', line 172 def to_s "#{year}-#{month}-#{day} #{hour}:#{minute}:#{second}" end |
#to_time ⇒ Object
176 177 178 |
# File 'lib/mack/controller/request.rb', line 176 def to_time Time.parse(self.to_s) end |