Class: Koyomi::Year
Instance Attribute Summary collapse
-
#first ⇒ Object
readonly
Returns the value of attribute first.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
-
#year ⇒ Object
readonly
——————–# instance methods.
Attributes inherited from Period
Class Method Summary collapse
-
.of(date = Date.today) ⇒ Koyomi::Year
create instance from date.
Instance Method Summary collapse
-
#initialize(year = nil) ⇒ Year
constructor
initialize instance.
- #month(month) ⇒ Object
- #uruu? ⇒ Boolean (also: #leap?)
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Koyomi::Period
Instance Attribute Details
#first ⇒ Object (readonly)
Returns the value of attribute first.
21 22 23 |
# File 'lib/koyomi/year.rb', line 21 def first @first end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
21 22 23 |
# File 'lib/koyomi/year.rb', line 21 def last @last end |
#year ⇒ Object (readonly)
——————–# instance methods
20 21 22 |
# File 'lib/koyomi/year.rb', line 20 def year @year end |
Class Method Details
.of(date = Date.today) ⇒ Koyomi::Year
create instance from date
13 14 15 |
# File 'lib/koyomi/year.rb', line 13 def self.of(date = Date.today) self.new(date.year) end |
Instance Method Details
#month(month) ⇒ Object
40 41 42 |
# File 'lib/koyomi/year.rb', line 40 def month(month) Koyomi::Month.new(month, year) end |
#uruu? ⇒ Boolean Also known as: leap?
44 45 46 47 48 49 50 51 52 |
# File 'lib/koyomi/year.rb', line 44 def uruu? begin Date.new(year, 2, 29) rescue ArgumentError => e false else true end end |