Class: Simmer::Judge::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/simmer/judge/result.rb

Overview

The return object of a Judge#assert call.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bad_assertions = []) ⇒ Result

Returns a new instance of Result.



16
17
18
19
20
# File 'lib/simmer/judge/result.rb', line 16

def initialize(bad_assertions = [])
  @bad_assertions = bad_assertions

  freeze
end

Instance Attribute Details

#bad_assertionsObject (readonly)

Returns the value of attribute bad_assertions.



14
15
16
# File 'lib/simmer/judge/result.rb', line 14

def bad_assertions
  @bad_assertions
end

Instance Method Details

#pass?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/simmer/judge/result.rb', line 22

def pass?
  bad_assertions.empty?
end

#to_hObject



26
27
28
29
30
31
# File 'lib/simmer/judge/result.rb', line 26

def to_h
  {
    'pass' => pass?,
    'bad_assertions' => bad_assertions.map(&:to_h)
  }
end