class RoadForest::SourceRigor::ResourceQuery
Attributes
options[RW]
patterns[RW]
solutions[RW]
source_rigor[RW]
subject_context[RW]
variables[RW]
Public Class Methods
from(other, subject_context = nil, source_rigor = nil)
click to toggle source
# File lib/roadforest/source-rigor/resource-query.rb, line 34 def self.from(other, subject_context = nil, source_rigor = nil) query = self.new if subject_context.nil? and other.respond_to?(:subject_context) query.subject_context = other.subject_context else query.subject_context = subject_context end if source_rigor.nil? and other.respond_to?(:source_rigor) query.source_rigor = other.source_rigor else query.source_rigor = source_rigor end other.patterns.each do |pattern| query.pattern(pattern) end query.variables = other.variables query.solutions = other.solutions query.options = other.options return query end
new(patterns = [], options = {}, &block)
click to toggle source
Calls superclass method
# File lib/roadforest/source-rigor/resource-query.rb, line 6 def initialize(patterns = [], options = {}, &block) @subject_context = options[:subject_context] @source_rigor = options[:source_rigor] super patterns = @patterns.dup @patterns.clear patterns.each do |pattern| pattern(pattern) end end
Public Instance Methods
<<(pattern)
click to toggle source
# File lib/roadforest/source-rigor/resource-query.rb, line 20 def <<(pattern) pattern(pattern) end
pattern(pattern, options = nil)
click to toggle source
# File lib/roadforest/source-rigor/resource-query.rb, line 24 def pattern(pattern, options = nil) options = { :context_roles => {:subject => subject_context}, :source_rigor => source_rigor }.merge(options || {}) @patterns << ResourcePattern.from(pattern, options) self end