Class: Zakuro::Japan::Type::Base::SwitchDate

Inherits:
Object
  • Object
show all
Defined in:
lib/zakuro/era/japan/type/base/switch_date.rb

Overview

SwitchDate 切替日(運用/計算)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(calculation: Both::Date.new, operation: Both::Date.new, operated: false) ⇒ SwitchDate

初期化

Parameters:

  • calculation (Both::Date) (defaults to: Both::Date.new)

    計算値

  • operation (Both::Date) (defaults to: Both::Date.new)

    運用値

  • operated (True, False) (defaults to: false)

    運用値設定



38
39
40
41
42
43
44
# File 'lib/zakuro/era/japan/type/base/switch_date.rb', line 38

def initialize(calculation: Both::Date.new, operation: Both::Date.new, operated: false)
  @calculation = calculation
  @operation = operation
  @operated = operated

  select
end

Instance Attribute Details

#calculationBoth::Date (readonly)

Returns 計算値.

Returns:



21
22
23
# File 'lib/zakuro/era/japan/type/base/switch_date.rb', line 21

def calculation
  @calculation
end

#japanJapan::Calendar (readonly)

Returns 和暦日.

Returns:



27
28
29
# File 'lib/zakuro/era/japan/type/base/switch_date.rb', line 27

def japan
  @japan
end

#operatedTrue, False (readonly)

Returns 運用値.

Returns:

  • (True, False)

    運用値



25
26
27
# File 'lib/zakuro/era/japan/type/base/switch_date.rb', line 25

def operated
  @operated
end

#operationBoth::Date (readonly)

Returns 運用値.

Returns:



23
24
25
# File 'lib/zakuro/era/japan/type/base/switch_date.rb', line 23

def operation
  @operation
end

#westernWestern::Calendar (readonly)

Returns 西暦日.

Returns:



29
30
31
# File 'lib/zakuro/era/japan/type/base/switch_date.rb', line 29

def western
  @western
end

Instance Method Details

#invalid?True, False

不正か

Returns:

  • (True)

    不正

  • (False)

    不正なし



52
53
54
# File 'lib/zakuro/era/japan/type/base/switch_date.rb', line 52

def invalid?
  japan.invalid? || western.invalid?
end