Class: Decentworks::DateSupport::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/decentworks/date_support/configuration.rb,
sig/decentworks/date_support/configuration.rbs

Constant Summary collapse

MONTHS =

{ january: 1, february: 2, ... december: 12 }

Returns:

  • (Hash[Symbol, Integer])
::Date::MONTHNAMES
.each_with_index
.filter_map { |name, index| [name.downcase.to_sym, index] if name }
.to_h
.freeze
DEFAULT =

開始月の初期値(1月)

Returns:

  • (Symbol)
:january

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



50
51
52
# File 'lib/decentworks/date_support/configuration.rb', line 50

def initialize
  @beginning_of_first_quarter = DEFAULT
end

Instance Attribute Details

#beginning_of_first_quarterSymbol

開始月

Returns:

  • (Symbol)


48
49
50
# File 'lib/decentworks/date_support/configuration.rb', line 48

def beginning_of_first_quarter
  @beginning_of_first_quarter
end

Instance Method Details

#beginning_of_first_quarter_monthInteger

開始月数

Returns:

  • (Integer)


64
# File 'lib/decentworks/date_support/configuration.rb', line 64

def beginning_of_first_quarter_month = MONTHS.fetch(beginning_of_first_quarter)

#first_quarter_month_offsetInteger

1月始まりとの開始月のずれ

Returns:

  • (Integer)


67
68
69
# File 'lib/decentworks/date_support/configuration.rb', line 67

def first_quarter_month_offset
  beginning_of_first_quarter_month - 1
end