Class: Streamer::Functors::Lookup

Inherits:
Functor
  • Object
show all
Defined in:
lib/streamer/functors/lookup.rb

Overview

Lookup looks up a fact given a finder

Instance Attribute Summary

Attributes inherited from Functor

#options, #payload

Instance Method Summary collapse

Methods inherited from Functor

#class_name, #initialize, #type_name

Constructor Details

This class inherits a constructor from Streamer::Functors::Functor

Instance Method Details

#callObject



5
6
7
8
# File 'lib/streamer/functors/lookup.rb', line 5

def call
  finder = options.fetch(:finder)
  finder.find(lookup_key)
end

#lookup_keyObject



10
11
12
13
# File 'lib/streamer/functors/lookup.rb', line 10

def lookup_key
  item_key = options.fetch(:terms)[0]
  options[:fact] = options.fetch(:fact).gsub('#', "#{item_key}.")
end