Class: Spectro::Spec::Rule
- Inherits:
-
Object
- Object
- Spectro::Spec::Rule
- Defined in:
- lib/spectro/spec/rule.rb
Overview
Assert representation based on input params and an expected output. Meant to be used against an algorith to test its behavior.
Instance Attribute Summary collapse
-
#output ⇒ Object
Returns the value of attribute output.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #==(rule) ⇒ Object
-
#initialize(params, output) ⇒ Rule
constructor
A new instance of Rule.
- #to_hash ⇒ Object
Constructor Details
#initialize(params, output) ⇒ Rule
Returns a new instance of Rule.
13 14 15 16 |
# File 'lib/spectro/spec/rule.rb', line 13 def initialize params, output self.output = output self.params = params end |
Instance Attribute Details
#output ⇒ Object
Returns the value of attribute output.
9 10 11 |
# File 'lib/spectro/spec/rule.rb', line 9 def output @output end |
#params ⇒ Object
Returns the value of attribute params.
9 10 11 |
# File 'lib/spectro/spec/rule.rb', line 9 def params @params end |
Instance Method Details
#==(rule) ⇒ Object
18 19 20 21 22 |
# File 'lib/spectro/spec/rule.rb', line 18 def == rule return \ self.output == rule.output && \ self.params == rule.params end |
#to_hash ⇒ Object
24 25 26 27 28 29 |
# File 'lib/spectro/spec/rule.rb', line 24 def to_hash return { output: self.output, params: self.params } end |