Class: PuppetDBQuery::Operator

Inherits:
Object
  • Object
show all
Defined in:
lib/puppetdb_query/operator.rb

Overview

operator with priority and representation information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, infix, priority, minimum, maximum = nil) ⇒ Operator

Returns a new instance of Operator.



13
14
15
16
17
18
19
20
# File 'lib/puppetdb_query/operator.rb', line 13

def initialize(symbol, infix, priority, minimum, maximum = nil)
  @symbol = symbol
  @infix = infix
  @priority = priority
  @minimum = minimum
  @maximum = maximum
  @string = Tokenizer.symbol_to_string(symbol)
end

Instance Attribute Details

#infixObject (readonly)

Returns the value of attribute infix.



7
8
9
# File 'lib/puppetdb_query/operator.rb', line 7

def infix
  @infix
end

#maximumObject (readonly)

Returns the value of attribute maximum.



10
11
12
# File 'lib/puppetdb_query/operator.rb', line 10

def maximum
  @maximum
end

#minimumObject (readonly)

Returns the value of attribute minimum.



9
10
11
# File 'lib/puppetdb_query/operator.rb', line 9

def minimum
  @minimum
end

#priorityObject (readonly)

Returns the value of attribute priority.



8
9
10
# File 'lib/puppetdb_query/operator.rb', line 8

def priority
  @priority
end

#stringObject (readonly)

Returns the value of attribute string.



11
12
13
# File 'lib/puppetdb_query/operator.rb', line 11

def string
  @string
end

#symbolObject (readonly)

Returns the value of attribute symbol.



6
7
8
# File 'lib/puppetdb_query/operator.rb', line 6

def symbol
  @symbol
end

Instance Method Details

#==(other) ⇒ Object



30
31
32
# File 'lib/puppetdb_query/operator.rb', line 30

def ==(other)
  other.class == self.class && other.symbol == symbol
end

#infix?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/puppetdb_query/operator.rb', line 22

def infix?
  infix
end

#prefix?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/puppetdb_query/operator.rb', line 26

def prefix?
  !infix
end

#to_sObject



34
35
36
# File 'lib/puppetdb_query/operator.rb', line 34

def to_s
  @string
end