class RoadForest::Augment::Augmenter
Attributes
services[R]
Public Class Methods
new(services)
click to toggle source
# File lib/roadforest/augment/augmenter.rb, line 7 def initialize(services) @services = services end
object_augmentations_registry()
click to toggle source
# File lib/roadforest/augment/augmenter.rb, line 24 def self.object_augmentations_registry @object_registry ||= Utility::ClassRegistry.new(self, "object augmentation") end
subject_augmentations_registry()
click to toggle source
# File lib/roadforest/augment/augmenter.rb, line 20 def self.subject_augmentations_registry @subject_registry ||= Utility::ClassRegistry.new(self, "subject augmentation") end
Public Instance Methods
augment(graph)
click to toggle source
# File lib/roadforest/augment/augmenter.rb, line 40 def augment(graph) augmenting = Augment::Process.new(graph) augmenting.subject_resources(router).each do |resource| subject_augmentations.each do |augmentation| augmentation.apply(resource) do |statement| augmenting.target_graph << statement end end end augmenting.object_resources(router).each do |resource| object_augmentations.each do |augmentation| augmentation.apply(resource) do |statement| augmenting.target_graph << statement end end end augmenting.target_graph end
canonical_uri()
click to toggle source
# File lib/roadforest/augment/augmenter.rb, line 16 def canonical_uri @canonical_uri ||= Addressable::URI.parse(services.root_url) end
object_augmentations()
click to toggle source
# File lib/roadforest/augment/augmenter.rb, line 34 def object_augmentations self.class.object_augmentations_registry.map_classes do |klass| klass.new(self) end end
router()
click to toggle source
# File lib/roadforest/augment/augmenter.rb, line 12 def router services.router end
subject_augmentations()
click to toggle source
# File lib/roadforest/augment/augmenter.rb, line 28 def subject_augmentations self.class.subject_augmentations_registry.map_classes do |klass| klass.new(self) end end