Class: Zakuro::Operation::Validator::Number
- Inherits:
-
Object
- Object
- Zakuro::Operation::Validator::Number
- Defined in:
- lib/zakuro/operation/month/validator.rb
Overview
Number 月
Constant Summary collapse
- NAME =
'number'
Instance Attribute Summary collapse
-
#dest ⇒ String
readonly
移動先.
-
#index ⇒ Integer
readonly
連番.
-
#src ⇒ String
readonly
移動元.
Instance Method Summary collapse
- #dest? ⇒ Boolean
-
#initialize(index:, yaml_hash: {}) ⇒ Number
constructor
初期化.
- #src? ⇒ Boolean
-
#validate ⇒ Array<String>
検証する.
Constructor Details
#initialize(index:, yaml_hash: {}) ⇒ Number
初期化
657 658 659 660 661 |
# File 'lib/zakuro/operation/month/validator.rb', line 657 def initialize(index:, yaml_hash: {}) @index = index @src = yaml_hash['src'] @dest = yaml_hash['dest'] end |
Instance Attribute Details
#dest ⇒ String (readonly)
Returns 移動先.
647 648 649 |
# File 'lib/zakuro/operation/month/validator.rb', line 647 def dest @dest end |
#index ⇒ Integer (readonly)
Returns 連番.
643 644 645 |
# File 'lib/zakuro/operation/month/validator.rb', line 643 def index @index end |
#src ⇒ String (readonly)
Returns 移動元.
645 646 647 |
# File 'lib/zakuro/operation/month/validator.rb', line 645 def src @src end |
Instance Method Details
#dest? ⇒ Boolean
684 685 686 |
# File 'lib/zakuro/operation/month/validator.rb', line 684 def dest? Types.positive?(str: dest) end |
#src? ⇒ Boolean
680 681 682 |
# File 'lib/zakuro/operation/month/validator.rb', line 680 def src? Types.positive?(str: src) end |
#validate ⇒ Array<String>
検証する
668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/zakuro/operation/month/validator.rb', line 668 def validate failed = [] prefix = "[#{index}][#{NAME}] invalid" failed.push("#{prefix} 'src'. #{src}") unless src? failed.push("#{prefix} 'dest'. #{dest}") unless dest? failed end |