Class: Attest::ExpectationResult
- Includes:
- Comparable
- Defined in:
- lib/attest/expectation_result.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#source_location ⇒ Object
Returns the value of attribute source_location.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(another_result) ⇒ Object
-
#initialize(attributes = {}) ⇒ ExpectationResult
constructor
A new instance of ExpectationResult.
- #status ⇒ Object
- #status_weight ⇒ Object
- #update(attributes = {}) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ ExpectationResult
Returns a new instance of ExpectationResult.
16 17 18 19 |
# File 'lib/attest/expectation_result.rb', line 16 def initialize(attributes={}) @outcome = nil @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
14 15 16 |
# File 'lib/attest/expectation_result.rb', line 14 def attributes @attributes end |
#source_location ⇒ Object
Returns the value of attribute source_location.
15 16 17 |
# File 'lib/attest/expectation_result.rb', line 15 def source_location @source_location end |
Class Method Details
.status_types ⇒ Object
5 6 7 |
# File 'lib/attest/expectation_result.rb', line 5 def status_types status_weights.keys end |
.status_weights ⇒ Object
9 10 11 |
# File 'lib/attest/expectation_result.rb', line 9 def status_weights {:success => 1, :failure => 2, :error => 3, :pending => 4, :disabled => 5} end |
Instance Method Details
#<=>(another_result) ⇒ Object
44 45 46 47 |
# File 'lib/attest/expectation_result.rb', line 44 def <=>(another_result) return 1 unless another_result self.status_weight <=> another_result.status_weight end |
#status ⇒ Object
32 33 34 |
# File 'lib/attest/expectation_result.rb', line 32 def status @outcome end |
#status_weight ⇒ Object
40 41 42 |
# File 'lib/attest/expectation_result.rb', line 40 def status_weight Attest::ExpectationResult.status_weights[status.to_sym] end |
#update(attributes = {}) ⇒ Object
36 37 38 |
# File 'lib/attest/expectation_result.rb', line 36 def update(attributes={}) @attributes.merge!(attributes) end |