Class: Date

Inherits:
Object
  • Object
show all
Includes:
ShiftyWeek
Defined in:
lib/shifty_week/date.rb

Direct Known Subclasses

DateTime

Constant Summary

Constants included from ShiftyWeek

ShiftyWeek::WORKER_FORMAT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ShiftyWeek

#days_in_month, included, #last_week_day, #month_name, #month_names, #step_to_month_end, #wday_offset, #week, #week_day_start, #week_days, #weeks_in_year

Instance Attribute Details

#week_day_start=(value) ⇒ Object (writeonly)

Sets the attribute week_day_start

Parameters:

  • value

    the value to set the attribute week_day_start to.



3
4
5
# File 'lib/shifty_week/date.rb', line 3

def week_day_start=(value)
  @week_day_start = value
end

Instance Method Details

#step(limit, step = 1) ⇒ Object

Seemed to make more sense to me to have step accept an integer number

see step_to_date for previous behavior. Although, you can still pass
a datetime object to this method and it will call the previous behavior.


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/shifty_week/date.rb', line 9

def step(limit, step=1)
  method = 'step_to_date'
  if limit.is_a?(Integer)
    limit = (self + limit)-1
    method = 'step'
  end
  send(method, limit, step) {|a_day| 
    a_day.week_day_start = self.week_day_start
    yield a_day 
  }
end

#step_to_dateObject

:nodoc:



5
# File 'lib/shifty_week/date.rb', line 5

alias_method :step_to_date, :step