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.



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

#dayObject

Returns the value of attribute day.



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

def day
  @day
end

#hourObject

Returns the value of attribute hour.



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

def hour
  @hour
end

#minuteObject

Returns the value of attribute minute.



156
157
158
# File 'lib/mack/controller/request.rb', line 156

def minute
  @minute
end

#monthObject

Returns the value of attribute month.



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

def month
  @month
end

#secondObject

Returns the value of attribute second.



157
158
159
# File 'lib/mack/controller/request.rb', line 157

def second
  @second
end

#yearObject

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_sObject



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

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

#to_timeObject



176
177
178
# File 'lib/mack/controller/request.rb', line 176

def to_time
  Time.parse(self.to_s)
end