Class: Zakuro::Operation::Validator::Month

Inherits:
Object
  • Object
show all
Defined in:
lib/zakuro/operation/month/validator.rb

Overview

Month 月

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index:, yaml_hash: {}) ⇒ Month

初期化

Parameters:

  • index (Integer)

    連番

  • yaml_hash (Hash<String, Object>) (defaults to: {})

    yaml

Options Hash (yaml_hash:):

  • :number (Hash)

    月差分

  • :leaped (Hash)

    閏有無差分

  • :days (String)

    中気差分



428
429
430
431
432
433
# File 'lib/zakuro/operation/month/validator.rb', line 428

def initialize(index:, yaml_hash: {})
  @index = index
  @number = Number.new(index: index, yaml_hash: yaml_hash['number'])
  @leaped = Leaped.new(index: index, yaml_hash: yaml_hash['leaped'])
  @days = Days.new(index: index, yaml_hash: yaml_hash['days'])
end

Instance Attribute Details

#daysString (readonly)

Returns 中気差分.

Returns:

  • (String)

    中気差分



417
418
419
# File 'lib/zakuro/operation/month/validator.rb', line 417

def days
  @days
end

#indexInteger (readonly)

Returns 連番.

Returns:

  • (Integer)

    連番



411
412
413
# File 'lib/zakuro/operation/month/validator.rb', line 411

def index
  @index
end

#leapedHash (readonly)

Returns 閏有無差分.

Returns:

  • (Hash)

    閏有無差分



415
416
417
# File 'lib/zakuro/operation/month/validator.rb', line 415

def leaped
  @leaped
end

#numberHash (readonly)

Returns 月差分.

Returns:

  • (Hash)

    月差分



413
414
415
# File 'lib/zakuro/operation/month/validator.rb', line 413

def number
  @number
end

Instance Method Details

#validateArray<String>

検証する

Returns:

  • (Array<String>)

    エラーメッセージ



440
441
442
443
444
445
446
447
448
449
450
# File 'lib/zakuro/operation/month/validator.rb', line 440

def validate
  failed = []

  failed += number.validate

  failed += leaped.validate

  failed += days.validate

  failed
end