Class: Time

Inherits:
Object
  • Object
show all
Includes:
WeekOfMonth::Day, WeekOfMonth::Month, WeekOfMonth::Week, WeekOfMonth::Year
Defined in:
lib/week_of_month.rb

Constant Summary

Constants included from WeekOfMonth::Constant

WeekOfMonth::Constant::DAYS_IN_SEQUENCE, WeekOfMonth::Constant::MONTH_WITH_DAY, WeekOfMonth::Constant::MONTH_WITH_SEQUENCE, WeekOfMonth::Constant::WEEK_OF_MONTH_IN_ENG, WeekOfMonth::Constant::WEEK_OF_MONTH_IN_FR, WeekOfMonth::Constant::WEEK_OF_MONTH_IN_GER, WeekOfMonth::Constant::WEEK_OF_MONTH_IN_JAP

Class Method Summary collapse

Instance Method Summary collapse

Methods included from WeekOfMonth::Year

included

Methods included from WeekOfMonth::Week

#beginning_of_week, #const, #current_week, #days_left_in_week, #days_past_in_week, #end_of_week, #first_week?, #general_week_of_month, #last_week?, #next_week, #previous_week, #second_week?, #total_weeks, #week_end?, #week_of_month, #week_split, #working_day?

Methods included from WeekOfMonth::Month

#beginning_of_month, #day_name, #end_of_month, #last_day_of_month, #month_name, #name_of_month

Methods included from WeekOfMonth::Day

#days_array, #name_of_week_day

Class Method Details

.new(year = Time.now.year, month = Time.now.month, day = Time.now.day, hour = Time.now.hour, min = Time.now.min, sec = Time.now.sec, millisecond = (Time.now.to_f * 1000.0).to_i) ⇒ Object



43
44
45
# File 'lib/week_of_month.rb', line 43

def self.new(year=Time.now.year, month=Time.now.month, day=Time.now.day, hour=Time.now.hour, min=Time.now.min, sec=Time.now.sec, millisecond=(Time.now.to_f * 1000.0).to_i)
  Time.local(year, month, day, hour, min, sec, millisecond)
end

Instance Method Details

#friday?Boolean

Returns:

  • (Boolean)


59
# File 'lib/week_of_month.rb', line 59

def friday?    ; self.wday == 5; end

#leap?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/week_of_month.rb', line 38

def leap?
  self.to_date.leap?
end

#monday?Boolean

Returns:

  • (Boolean)


55
# File 'lib/week_of_month.rb', line 55

def monday?    ; self.wday == 1; end

#saturday?Boolean

Returns:

  • (Boolean)


60
# File 'lib/week_of_month.rb', line 60

def saturday?  ; self.wday == 6; end

#sunday?Boolean

Returns:

  • (Boolean)


54
# File 'lib/week_of_month.rb', line 54

def sunday?    ; self.wday == 0; end

#thursday?Boolean

Returns:

  • (Boolean)


58
# File 'lib/week_of_month.rb', line 58

def thursday?  ; self.wday == 4; end

#to_dateObject



49
50
51
# File 'lib/week_of_month.rb', line 49

def to_date
  ::Date.new(year, month, day)
end

#tuesday?Boolean

Returns:

  • (Boolean)


56
# File 'lib/week_of_month.rb', line 56

def tuesday?   ; self.wday == 2; end

#wednesday?Boolean

Returns:

  • (Boolean)


57
# File 'lib/week_of_month.rb', line 57

def wednesday? ; self.wday == 3; end