Class: Mack::Request::DateTimeParameter
- Inherits:
-
Object
- Object
- 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.
156 157 158 159 160 161 162 163 |
# File 'lib/mack/controller/request.rb', line 156 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.
151 152 153 |
# File 'lib/mack/controller/request.rb', line 151 def day @day end |
#hour ⇒ Object
Returns the value of attribute hour.
152 153 154 |
# File 'lib/mack/controller/request.rb', line 152 def hour @hour end |
#minute ⇒ Object
Returns the value of attribute minute.
153 154 155 |
# File 'lib/mack/controller/request.rb', line 153 def minute @minute end |
#month ⇒ Object
Returns the value of attribute month.
150 151 152 |
# File 'lib/mack/controller/request.rb', line 150 def month @month end |
#second ⇒ Object
Returns the value of attribute second.
154 155 156 |
# File 'lib/mack/controller/request.rb', line 154 def second @second end |
#year ⇒ Object
Returns the value of attribute year.
149 150 151 |
# File 'lib/mack/controller/request.rb', line 149 def year @year end |
Instance Method Details
#add(key, value) ⇒ Object
165 166 167 |
# File 'lib/mack/controller/request.rb', line 165 def add(key, value) self.send("#{key}=", value) end |
#to_s ⇒ Object
169 170 171 |
# File 'lib/mack/controller/request.rb', line 169 def to_s "#{year}-#{month}-#{day} #{hour}:#{minute}:#{second}" end |
#to_time ⇒ Object
173 174 175 |
# File 'lib/mack/controller/request.rb', line 173 def to_time Time.parse(self.to_s) end |