class Definition::Types::Include::Conformer
Attributes
definition[RW]
Public Class Methods
new(definition)
click to toggle source
# File lib/definition/types/include.rb, line 21 def initialize(definition) self.definition = definition end
Public Instance Methods
conform(value)
click to toggle source
# File lib/definition/types/include.rb, line 25 def conform(value) errors = gather_errors(value) if errors.empty? ConformResult.new(value) else ConformResult.new(value, errors: errors) end end
Private Instance Methods
gather_errors(value)
click to toggle source
# File lib/definition/types/include.rb, line 37 def gather_errors(value) definition.required_items.map do |item| next if value.include?(item) KeyConformError.new(definition, "#{definition.name} does not include #{item.inspect}", key: item) end.compact end