Class: TreeBranch::Comparator
- Inherits:
-
Object
- Object
- TreeBranch::Comparator
- Defined in:
- lib/tree_branch/comparator.rb
Overview
This is the base class for all plug in comparators. Derive subclasses from this class and declare them when calling ::TreeBranch::Node#process or ::TreeBranch#process.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data: {}, context: {}) ⇒ Comparator
constructor
A new instance of Comparator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(data: {}, context: {}) ⇒ Comparator
Returns a new instance of Comparator.
16 17 18 19 |
# File 'lib/tree_branch/comparator.rb', line 16 def initialize(data: {}, context: {}) @data = data || {} @context = context || {} end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
14 15 16 |
# File 'lib/tree_branch/comparator.rb', line 14 def context @context end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
14 15 16 |
# File 'lib/tree_branch/comparator.rb', line 14 def data @data end |
Instance Method Details
#valid? ⇒ Boolean
21 22 23 |
# File 'lib/tree_branch/comparator.rb', line 21 def valid? false end |