Class: Definition::ConformResult

Inherits:
Object
  • Object
show all
Defined in:
lib/definition/conform_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, errors: []) ⇒ ConformResult

Returns a new instance of ConformResult.



5
6
7
8
# File 'lib/definition/conform_result.rb', line 5

def initialize(value, errors: [])
  self.value = value
  self.errors = errors
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



10
11
12
# File 'lib/definition/conform_result.rb', line 10

def errors
  @errors
end

#valueObject

Returns the value of attribute value.



10
11
12
# File 'lib/definition/conform_result.rb', line 10

def value
  @value
end

Instance Method Details

#error_messageObject



16
17
18
# File 'lib/definition/conform_result.rb', line 16

def error_message
  errors.map(&:message).join(", ")
end

#passed?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/definition/conform_result.rb', line 12

def passed?
  errors.empty?
end