Class: Cal::Year

Inherits:
Object
  • Object
show all
Defined in:
lib/cal/year.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(calendar) ⇒ Year

Returns a new instance of Year.



4
5
6
# File 'lib/cal/year.rb', line 4

def initialize(calendar)
  @calendar = calendar
end

Instance Attribute Details

#calendarObject (readonly)

Returns the value of attribute calendar.



8
9
10
# File 'lib/cal/year.rb', line 8

def calendar
  @calendar
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
# File 'lib/cal/year.rb', line 10

def ==(other)
  other.is_a?(Year) && other.calendar == calendar
end

#to_sObject



14
15
16
# File 'lib/cal/year.rb', line 14

def to_s
  calendar.date.strftime "%Y"
end