class Burner::Library::Collection::Graph
Take an array of (denormalized) objects and create an object hierarchy from them. Under the hood it uses Hashematics: github.com/bluemarblepayroll/hashematics.
Expected Payload input: array of objects. Payload output: An array of objects.
Attributes
groups[R]
key[R]
Public Class Methods
new( key:, config: Hashematics::Configuration.new, name: '', register: DEFAULT_REGISTER )
click to toggle source
Calls superclass method
Burner::JobWithRegister::new
# File lib/burner/library/collection/graph.rb, line 21 def initialize( key:, config: Hashematics::Configuration.new, name: '', register: DEFAULT_REGISTER ) super(name: name, register: register) raise ArgumentError, 'key is required' if key.to_s.empty? @groups = Hashematics::Configuration.new(config).groups @key = key.to_s freeze end
Public Instance Methods
perform(output, payload)
click to toggle source
# File lib/burner/library/collection/graph.rb, line 37 def perform(output, payload) graph = Hashematics::Graph.new(groups).add(array(payload[register])) output.detail("Graphing: #{key}") payload[register] = graph.data(key) end