Class: Zakuro::Calculation::Summary::Month
- Inherits:
-
Object
- Object
- Zakuro::Calculation::Summary::Month
- Defined in:
- lib/zakuro/calculation/summary/internal/month.rb
Overview
Month 特定月
Instance Attribute Summary collapse
-
#context ⇒ Context::Context
readonly
暦コンテキスト.
-
#last_date ⇒ Western::Calendar
readonly
西暦終了日.
-
#month ⇒ Monthly::Month
readonly
月.
-
#start_date ⇒ Western::Calendar
readonly
西暦開始日.
-
#year ⇒ Base::Year
readonly
年.
Instance Method Summary collapse
-
#get ⇒ Array<Result::Data::SingleDay>
取得する.
-
#include?(date:) ⇒ True, False
含まれるか.
-
#initialize(context:, start_date:, last_date:, year:, month:) ⇒ Month
constructor
初期化.
Constructor Details
#initialize(context:, start_date:, last_date:, year:, month:) ⇒ Month
初期化
38 39 40 41 42 43 44 |
# File 'lib/zakuro/calculation/summary/internal/month.rb', line 38 def initialize(context:, start_date:, last_date:, year:, month:) @context = context @start_date = start_date @last_date = last_date @year = year @month = month end |
Instance Attribute Details
#context ⇒ Context::Context (readonly)
Returns 暦コンテキスト.
19 20 21 |
# File 'lib/zakuro/calculation/summary/internal/month.rb', line 19 def context @context end |
#last_date ⇒ Western::Calendar (readonly)
Returns 西暦終了日.
23 24 25 |
# File 'lib/zakuro/calculation/summary/internal/month.rb', line 23 def last_date @last_date end |
#month ⇒ Monthly::Month (readonly)
Returns 月.
27 28 29 |
# File 'lib/zakuro/calculation/summary/internal/month.rb', line 27 def month @month end |
#start_date ⇒ Western::Calendar (readonly)
Returns 西暦開始日.
21 22 23 |
# File 'lib/zakuro/calculation/summary/internal/month.rb', line 21 def start_date @start_date end |
#year ⇒ Base::Year (readonly)
Returns 年.
25 26 27 |
# File 'lib/zakuro/calculation/summary/internal/month.rb', line 25 def year @year end |
Instance Method Details
#get ⇒ Array<Result::Data::SingleDay>
取得する
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/zakuro/calculation/summary/internal/month.rb', line 51 def get result = [] first_date = month.western_date.clone (0..month.days).each do |index| current_date = first_date.clone + index next unless include?(date: current_date) day = single_day(current_date: current_date) result.push(day) end result end |
#include?(date:) ⇒ True, False
含まれるか
76 77 78 79 80 81 82 |
# File 'lib/zakuro/calculation/summary/internal/month.rb', line 76 def include?(date:) return false if date < start_date return false if date > last_date true end |