class Zakuro::Operation::Validator::Annotation
Annotation
注釈
Attributes
description[R]
@return [String] 注釈内容
id[R]
@return [String] ID
index[R]
@return [Integer] 連番
note[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] :description 注釈内容 @option yaml_hash [String] :note 補足
# File lib/zakuro/operation/month/validator.rb, line 239 def initialize(index:, yaml_hash: {}) @index = index @id = yaml_hash['id'] @description = yaml_hash['description'] @note = yaml_hash['note'] end
Public Instance Methods
description?()
click to toggle source
# File lib/zakuro/operation/month/validator.rb, line 271 def description? Types.empiable_string?(str: @description) end
id?()
click to toggle source
# File lib/zakuro/operation/month/validator.rb, line 267 def id? Types.string?(str: @id) end
note?()
click to toggle source
# File lib/zakuro/operation/month/validator.rb, line 275 def note? Types.string?(str: @note) end
validate()
click to toggle source
検証する
@return [Array<String>] エラーメッセージ
# File lib/zakuro/operation/month/validator.rb, line 253 def validate failed = [] prefix = "[#{@index}] invalid" failed.push("#{prefix} 'id'. #{@id}") unless id? failed.push("#{prefix} 'description'. #{@description}") unless description? failed.push("#{prefix} 'note'. #{@note}") unless note? failed end