class PuppetDBQuery::Term
represent a term containing an operator and arguments
Attributes
args[R]
operator[R]
Public Class Methods
new(operator)
click to toggle source
# File lib/puppetdb_query/term.rb, line 7 def initialize(operator) @operator = operator @args = [] end
Public Instance Methods
==(other)
click to toggle source
# File lib/puppetdb_query/term.rb, line 17 def ==(other) other.class == self.class && other.operator == operator && other.args == args end
add(*arg)
click to toggle source
# File lib/puppetdb_query/term.rb, line 12 def add(*arg) @args += arg self end
to_s()
click to toggle source
# File lib/puppetdb_query/term.rb, line 21 def to_s if operator.prefix? "#{operator}(#{args.join(', ')})" elsif operator.infix? "(#{args.join(" #{operator} ")})" else raise "unkown representation for operator: #{operator}" end end