Class: Arity1Operators

Inherits:
Operator show all
Defined in:
lib/lamep/Expressions/arity1_operators.rb

Direct Known Subclasses

UnaryMinus, ValueExpression

Constant Summary collapse

ARITY =
1

Constants inherited from Operator

Operator::OPERATORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Operator

exists?, factory!, operator, precedence!, register, #to_sql

Constructor Details

#initialize(operand) ⇒ Arity1Operators

Returns a new instance of Arity1Operators.



10
11
12
# File 'lib/lamep/Expressions/arity1_operators.rb', line 10

def initialize(operand)
  @operand = (operand.is_a?(Operator)) ? operand : ValueExpression.new(operand)
end

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



3
4
5
# File 'lib/lamep/Expressions/arity1_operators.rb', line 3

def operand
  @operand
end

Instance Method Details

#==(other) ⇒ Object Also known as: equal?



6
7
8
# File 'lib/lamep/Expressions/arity1_operators.rb', line 6

def ==(other)
  other.class == self.class && other.operand == @operand
end