Class: Time
Instance Method Summary
collapse
#beginning_of, db_time_format, db_time_format=, #iso8601?, iso8601?, #to_cubicle
Instance Method Details
#step_by ⇒ Object
6
7
8
|
# File 'lib/cubicle/support.rb', line 6
def step_by
@step_by ||= :second
end
|
#step_by=(by) ⇒ Object
10
11
12
|
# File 'lib/cubicle/support.rb', line 10
def step_by=(by)
@step_by = by
end
|
#succ ⇒ Object
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/cubicle/support.rb', line 14
def succ
self.step_by = :day if step_by.to_sym == :date
valid_steps = [:second,:minute,:hour,:week,:day,:month,:year]
valid_steps += valid_steps.map{|s|s.to_s.pluralize.to_sym}
raise "Invalid 'step_by' speficication. Was #{step_by} but must be one of #{valid_steps.inspect}" unless valid_steps.include?(step_by.to_sym)
next_date = advance(step_by.to_s.pluralize.to_sym=>1)
next_date.step_by = self.step_by
next_date
end
|