Class: Solanum::Matcher
- Inherits:
-
Object
- Object
- Solanum::Matcher
- Defined in:
- lib/solanum/matcher.rb
Overview
A matcher takes in an input string and returns a hash of measurement names to numeric values.
- Author
-
Greg Look
Direct Known Subclasses
Defined Under Namespace
Classes: JSONReader, LinePattern
Instance Attribute Summary collapse
-
#fn ⇒ Object
readonly
Returns the value of attribute fn.
Instance Method Summary collapse
-
#call(input) ⇒ Object
Attempts to match the given input, returning a hash of metrics.
-
#initialize(fn) ⇒ Matcher
constructor
Creates a new Matcher which will run the given function on input.
Constructor Details
#initialize(fn) ⇒ Matcher
Creates a new Matcher which will run the given function on input.
11 12 13 14 |
# File 'lib/solanum/matcher.rb', line 11 def initialize(fn) raise "function must be provided" if fn.nil? @fn = fn end |
Instance Attribute Details
#fn ⇒ Object (readonly)
Returns the value of attribute fn.
8 9 10 |
# File 'lib/solanum/matcher.rb', line 8 def fn @fn end |
Instance Method Details
#call(input) ⇒ Object
Attempts to match the given input, returning a hash of metrics.
17 18 19 |
# File 'lib/solanum/matcher.rb', line 17 def call(input) {} end |