Class: Dat::Analysis::Matcher
- Inherits:
-
Object
- Object
- Dat::Analysis::Matcher
- Defined in:
- lib/dat/analysis/matcher.rb
Overview
Public: Base class for science mismatch results matchers. Subclasses
implement the `#match?` instance method, which returns true when
a provided science mismatch result is recognized by the matcher.
Subclasses are expected to define ‘#match?`.
Subclasses may optionally define ‘#readable` to return an alternative readable String representation of a cooked science mismatch result. The default implementation is defined in Dat::Analysis#readable.
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Public: The science mismatch result to be matched.
Class Method Summary collapse
-
.add_to_analyzer(analyzer) ⇒ Object
Internal: Add this class to a Dat::Analysis instance.
-
.inherited(subclass) ⇒ Object
Internal: Called at subclass instantiation time to register the subclass with Dat::Analysis::Library.
Instance Method Summary collapse
-
#initialize(result) ⇒ Matcher
constructor
Public: create a new Matcher.
Constructor Details
#initialize(result) ⇒ Matcher
Public: create a new Matcher.
result - a science mismatch result, to be tested via ‘#match?`
39 40 41 |
# File 'lib/dat/analysis/matcher.rb', line 39 def initialize(result) @result = result end |
Instance Attribute Details
#result ⇒ Object (readonly)
Public: The science mismatch result to be matched.
14 15 16 |
# File 'lib/dat/analysis/matcher.rb', line 14 def result @result end |
Class Method Details
.add_to_analyzer(analyzer) ⇒ Object
Internal: Add this class to a Dat::Analysis instance. Intended to be
called from Dat::Analysis to dispatch registration.
analyzer - a Dat::Analysis instance for an experiment
Returns the analyzer’s updated list of known matcher classes.
32 33 34 |
# File 'lib/dat/analysis/matcher.rb', line 32 def self.add_to_analyzer(analyzer) analyzer.add_matcher self end |
.inherited(subclass) ⇒ Object
Internal: Called at subclass instantiation time to register the subclass
with Dat::Analysis::Library.
subclass - The Dat::Analysis::Matcher subclass being instantiated.
Not intended to be called directly.
22 23 24 |
# File 'lib/dat/analysis/matcher.rb', line 22 def self.inherited(subclass) Dat::Analysis::Library.add subclass end |