class Streamer::StreamBuilder
StreamBuilder
takes a stream configuration and builds the stream defined in it. StreamBuilder
then performs the stream, given a document.
Attributes
config[R]
payload[R]
Public Class Methods
new(config)
click to toggle source
# File lib/streamer/stream_builder.rb, line 6 def initialize(config) @config = config end
Public Instance Methods
filter_value()
click to toggle source
# File lib/streamer/stream_builder.rb, line 25 def filter_value config[:filter].inject(true) do |val, f| val &&= stream.filter(function: f[:function]).payload['filter_value'] val end end
process(payload)
click to toggle source
# File lib/streamer/stream_builder.rb, line 10 def process(payload) @payload = payload stream.payload['filter_value'] = filter_value transform if stream.payload['filter_value'] stream end
stream()
click to toggle source
# File lib/streamer/stream_builder.rb, line 32 def stream @stream ||= Stream.new(payload) end
transform()
click to toggle source
# File lib/streamer/stream_builder.rb, line 17 def transform config[:transform].each do |tx| tx.each do |k, v| stream.send(k, v) end end end