Class: Squeel::Nodes::Unary

Inherits:
Object
  • Object
show all
Includes:
PredicateOperators
Defined in:
lib/squeel/nodes/unary.rb

Overview

A node that contains a single expression.

Direct Known Subclasses

Not

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PredicateOperators

#&, #-@, #|

Constructor Details

#initialize(expr) ⇒ Unary

Create a new Unary node.

Parameters:

  • expr

    The expression to contain inside the node.



15
16
17
# File 'lib/squeel/nodes/unary.rb', line 15

def initialize(expr)
  @expr = expr
end

Instance Attribute Details

#exprObject (readonly)

Returns The expression contained in the node.

Returns:

  • The expression contained in the node



11
12
13
# File 'lib/squeel/nodes/unary.rb', line 11

def expr
  @expr
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Object comparison

Returns:

  • (Boolean)


20
21
22
23
# File 'lib/squeel/nodes/unary.rb', line 20

def eql?(other)
  self.class == other.class &&
  self.expr  == other.expr
end