Class: Mack::Request::DateTimeParameter

Inherits:
Object
  • Object
show all
Defined in:
lib/mack/controller/request.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDateTimeParameter

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

#dayObject

Returns the value of attribute day.



151
152
153
# File 'lib/mack/controller/request.rb', line 151

def day
  @day
end

#hourObject

Returns the value of attribute hour.



152
153
154
# File 'lib/mack/controller/request.rb', line 152

def hour
  @hour
end

#minuteObject

Returns the value of attribute minute.



153
154
155
# File 'lib/mack/controller/request.rb', line 153

def minute
  @minute
end

#monthObject

Returns the value of attribute month.



150
151
152
# File 'lib/mack/controller/request.rb', line 150

def month
  @month
end

#secondObject

Returns the value of attribute second.



154
155
156
# File 'lib/mack/controller/request.rb', line 154

def second
  @second
end

#yearObject

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_sObject



169
170
171
# File 'lib/mack/controller/request.rb', line 169

def to_s
  "#{year}-#{month}-#{day} #{hour}:#{minute}:#{second}"
end

#to_timeObject



173
174
175
# File 'lib/mack/controller/request.rb', line 173

def to_time
  Time.parse(self.to_s)
end