Class: TreeBranch::Comparator

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#contextObject (readonly)

Returns the value of attribute context.



14
15
16
# File 'lib/tree_branch/comparator.rb', line 14

def context
  @context
end

#dataObject (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

Returns:

  • (Boolean)


21
22
23
# File 'lib/tree_branch/comparator.rb', line 21

def valid?
  false
end