Class: Mack::Request::DateTimeParameter
- Defined in:
- lib/mack/controller/request/date_time_parameter.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.
13 14 15 16 17 18 19 20 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 13 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.
8 9 10 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 8 def day @day end |
#hour ⇒ Object
Returns the value of attribute hour.
9 10 11 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 9 def hour @hour end |
#minute ⇒ Object
Returns the value of attribute minute.
10 11 12 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 10 def minute @minute end |
#month ⇒ Object
Returns the value of attribute month.
7 8 9 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 7 def month @month end |
#second ⇒ Object
Returns the value of attribute second.
11 12 13 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 11 def second @second end |
#year ⇒ Object
Returns the value of attribute year.
6 7 8 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 6 def year @year end |
Instance Method Details
#add(key, value) ⇒ Object
22 23 24 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 22 def add(key, value) self.send("#{key}=", value) end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/mack/controller/request/date_time_parameter.rb', line 26 def to_s "#{year}-#{month}-#{day} #{hour}:#{minute}:#{second}" end |