Class: Zakuro::Calculation::Monthly::MonthLabel
- Inherits:
-
Object
- Object
- Zakuro::Calculation::Monthly::MonthLabel
- Defined in:
- lib/zakuro/calculation/monthly/internal/part/month_label.rb
Overview
MonthLabel 月表示情報
Instance Attribute Summary collapse
- #is_many_days ⇒ True, False readonly
- #leaped ⇒ True, False readonly
-
#number ⇒ Integer
readonly
月(xx月のxx).
Instance Method Summary collapse
-
#back_to_last_month ⇒ True, False
一ヶ月戻す.
-
#days ⇒ Integer
月の日数を返す.
-
#days_name ⇒ String
月の名前(大小)を返す.
-
#initialize(number: -1,, is_many_days: false, leaped: false) ⇒ MonthLabel
constructor
初期化.
-
#same?(other:) ⇒ True, False
同一の月情報かを検証する.
Constructor Details
#initialize(number: -1,, is_many_days: false, leaped: false) ⇒ MonthLabel
初期化
31 32 33 34 35 36 37 38 |
# File 'lib/zakuro/calculation/monthly/internal/part/month_label.rb', line 31 def initialize(number: -1, is_many_days: false, leaped: false) # 月の大小 @is_many_days = is_many_days # 月 @number = number # 閏 @leaped = leaped end |
Instance Attribute Details
#is_many_days ⇒ True, False (readonly)
15 16 17 |
# File 'lib/zakuro/calculation/monthly/internal/part/month_label.rb', line 15 def is_many_days @is_many_days end |
#leaped ⇒ True, False (readonly)
20 21 22 |
# File 'lib/zakuro/calculation/monthly/internal/part/month_label.rb', line 20 def leaped @leaped end |
#number ⇒ Integer (readonly)
Returns 月(xx月のxx).
17 18 19 |
# File 'lib/zakuro/calculation/monthly/internal/part/month_label.rb', line 17 def number @number end |
Instance Method Details
#back_to_last_month ⇒ True, False
一ヶ月戻す
64 65 66 67 68 69 70 71 72 |
# File 'lib/zakuro/calculation/monthly/internal/part/month_label.rb', line 64 def back_to_last_month @number -= 1 return false if number.positive? @number = 12 true end |
#days ⇒ Integer
月の日数を返す
45 46 47 |
# File 'lib/zakuro/calculation/monthly/internal/part/month_label.rb', line 45 def days is_many_days ? 30 : 29 end |
#days_name ⇒ String
月の名前(大小)を返す
54 55 56 |
# File 'lib/zakuro/calculation/monthly/internal/part/month_label.rb', line 54 def days_name is_many_days ? '大' : '小' end |
#same?(other:) ⇒ True, False
同一の月情報かを検証する
82 83 84 |
# File 'lib/zakuro/calculation/monthly/internal/part/month_label.rb', line 82 def same?(other:) number == other.number && leaped == other.leaped end |