Class: Seaquel::AST::JoinOp

Inherits:
Expression show all
Extended by:
Forwardable
Defined in:
lib/seaquel/ast/join_op.rb

Overview

A binary operation that can be used to join things together, like ‘AND’ or ‘OR’.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

#as, #asc, binop, #desc, joinop, #lisp_inspect, unaryop

Constructor Details

#initialize(op, elements = []) ⇒ JoinOp

Returns a new instance of JoinOp.



14
15
16
# File 'lib/seaquel/ast/join_op.rb', line 14

def initialize op, elements=[]
  @op, @elements = op, elements
end

Instance Attribute Details

#elementsObject (readonly)

Returns the value of attribute elements.



12
13
14
# File 'lib/seaquel/ast/join_op.rb', line 12

def elements
  @elements
end

#opObject (readonly)

Returns the value of attribute op.



11
12
13
# File 'lib/seaquel/ast/join_op.rb', line 11

def op
  @op
end

Instance Method Details

#concat(*more) ⇒ Object



18
19
20
21
22
# File 'lib/seaquel/ast/join_op.rb', line 18

def concat *more
  more.each do |el|
    elements << el
  end
end

#empty?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/seaquel/ast/join_op.rb', line 24

def empty?
  elements.empty?
end

#inspectObject



32
33
34
# File 'lib/seaquel/ast/join_op.rb', line 32

def inspect
  lisp_inspect(:join_op, op, elements)
end

#visit(visitor) ⇒ Object



28
29
30
# File 'lib/seaquel/ast/join_op.rb', line 28

def visit visitor
  visitor.visit_joinop(op, elements)
end