Class: ArcFurnace::Observer

Inherits:
Source show all
Defined in:
lib/arc-furnace/observer.rb

Direct Known Subclasses

BlockObserver

Instance Attribute Summary

Attributes inherited from Node

#error_handler, #node_id, #params

Instance Method Summary collapse

Methods inherited from Source

#advance, #close, #empty?, #finalize, #prepare, #row

Constructor Details

#initialize(source:) ⇒ Observer

Returns a new instance of Observer.



9
10
11
# File 'lib/arc-furnace/observer.rb', line 9

def initialize(source:)
  @source = source
end

Instance Method Details

#observe(row) ⇒ Object

Observes each row in the node’s input stream. This node should not modify the row passed.

This method’s return value is ignored



25
26
27
# File 'lib/arc-furnace/observer.rb', line 25

def observe(row)
  raise "Unimplemented"
end

#valueObject



13
14
15
16
17
# File 'lib/arc-furnace/observer.rb', line 13

def value
  value = source.value.deep_dup
  observe(value) if value
  value
end