class Zakuro::Operation::Validator::MonthHistory
MonthHistory
変更履歴
Attributes
id[R]
@return [String] ID
index[R]
@return [Integer] 連番
modified[R]
@return [String] 有効行
parend_id[R]
@return [String] 親ID
western_date[R]
@return [String] 西暦日
Public Class Methods
new(index:, yaml_hash: {})
click to toggle source
初期化
@param [Integer] index 連番 @param [Hash<String, String>] yaml_hash yaml @option yaml_hash [String] :id ID @option yaml_hash [String] :parent_id 親ID @option yaml_hash [String] :western_date 西暦日 @option yaml_hash [String] :modified 有効行
# File lib/zakuro/operation/month/validator.rb, line 169 def initialize(index:, yaml_hash: {}) @index = index @id = yaml_hash['id'] @parent_id = yaml_hash['parent_id'] @western_date = yaml_hash['western_date'] @modified = yaml_hash['modified'] end
Public Instance Methods
id?()
click to toggle source
# File lib/zakuro/operation/month/validator.rb, line 200 def id? Types.string?(str: @id) end
modified?()
click to toggle source
# File lib/zakuro/operation/month/validator.rb, line 212 def modified? Types.bool?(str: @modified) end
parent_id?()
click to toggle source
# File lib/zakuro/operation/month/validator.rb, line 204 def parent_id? Types.string?(str: @parent_id) end
validate()
click to toggle source
検証する
@return [Array<String>] エラーメッセージ
# File lib/zakuro/operation/month/validator.rb, line 184 def validate failed = [] prefix = "[#{@index}] invalid" failed.push("#{prefix} 'id'. #{@id}") unless id? failed.push("#{prefix} 'parent_id'. #{@id}") unless parent_id? failed.push("#{prefix} 'western_date'. #{@western_date}") unless western_date? failed.push("#{prefix} 'modified'. #{@modified}") unless modified? failed end
western_date?()
click to toggle source
# File lib/zakuro/operation/month/validator.rb, line 208 def western_date? Types.western_date?(str: @western_date) end