Class: Zakuro::Operation::Validator::Leaped

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

Overview

Leaped 閏有無

Constant Summary collapse

NAME =
'leaped'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

初期化

Parameters:

  • index (Integer)

    連番

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

    yaml

Options Hash (yaml_hash:):

  • :src (String)

    移動元

  • :dest (String)

    移動先



710
711
712
713
714
# File 'lib/zakuro/operation/month/validator.rb', line 710

def initialize(index:, yaml_hash: {})
  @index = index
  @src = yaml_hash['src']
  @dest = yaml_hash['dest']
end

Instance Attribute Details

#destString (readonly)

Returns 移動先.

Returns:

  • (String)

    移動先



700
701
702
# File 'lib/zakuro/operation/month/validator.rb', line 700

def dest
  @dest
end

#indexInteger (readonly)

Returns 連番.

Returns:

  • (Integer)

    連番



696
697
698
# File 'lib/zakuro/operation/month/validator.rb', line 696

def index
  @index
end

#srcString (readonly)

Returns 移動元.

Returns:

  • (String)

    移動元



698
699
700
# File 'lib/zakuro/operation/month/validator.rb', line 698

def src
  @src
end

Instance Method Details

#dest?Boolean

Returns:

  • (Boolean)


737
738
739
# File 'lib/zakuro/operation/month/validator.rb', line 737

def dest?
  Types.empiable_bool?(str: dest)
end

#src?Boolean

Returns:

  • (Boolean)


733
734
735
# File 'lib/zakuro/operation/month/validator.rb', line 733

def src?
  Types.empiable_bool?(str: src)
end

#validateArray<String>

検証する

Returns:

  • (Array<String>)

    エラーメッセージ



721
722
723
724
725
726
727
728
729
730
731
# File 'lib/zakuro/operation/month/validator.rb', line 721

def validate
  failed = []

  prefix = "[#{index}][#{NAME}] invalid"

  failed.push("#{prefix} 'src'. #{src}") unless src?

  failed.push("#{prefix} 'dest'. #{dest}") unless dest?

  failed
end