Class: RubyCalendar::Calendar

Inherits:
Object
  • Object
show all
Includes:
Month, Year
Defined in:
lib/ruby_calendar/calendar.rb

Constant Summary collapse

WEEK_DAY_NAME =
%w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday].freeze

Constants included from Year

Year::MONTH_NAMES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Year

#year

Methods included from Month

#month

Constructor Details

#initialize(year = today_year, month = today_month, firstweekday: 0) ⇒ Calendar

Returns a new instance of Calendar.



15
16
17
18
19
# File 'lib/ruby_calendar/calendar.rb', line 15

def initialize(year = today_year, month = today_month, firstweekday: 0)
  @year = year
  @month = month
  @firstweekday = firstweekday
end

Instance Attribute Details

#firstweekdayObject

Returns the value of attribute firstweekday.



11
12
13
# File 'lib/ruby_calendar/calendar.rb', line 11

def firstweekday
  @firstweekday
end

Instance Method Details

#set_firstweekday(firstweekday) ⇒ Object



31
32
33
34
# File 'lib/ruby_calendar/calendar.rb', line 31

def set_firstweekday(firstweekday)
  @firstweekday = firstweekday
  self
end

#set_month(month) ⇒ Object



26
27
28
29
# File 'lib/ruby_calendar/calendar.rb', line 26

def set_month(month)
  @month = month
  self
end

#set_year(year) ⇒ Object



21
22
23
24
# File 'lib/ruby_calendar/calendar.rb', line 21

def set_year(year)
  @year = year
  self
end