Class: Ferret::Stage

Inherits:
Object
  • Object
show all
Defined in:
lib/sql-ferret.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, stalk, join_type) ⇒ Stage

Returns a new instance of Stage.



1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
# File 'lib/sql-ferret.rb', line 1354

def initialize parent, stalk, join_type
  raise 'type mismatch' \
      unless parent.nil? or parent.is_a? Ferret::Stage
  raise 'type mismatch' \
      unless parent.nil? ?
          stalk.nil? : stalk.is_a?(Ferret::Field)
  raise 'assertion failed' \
      unless [:left, :inner].include? join_type
  super()
  @parent = parent
  @stalk = stalk
  @join_type = join_type

  # If we have a stalk, it identifies this stage's table.
  # If not (which only happens for the very first stage),
  # the parser will use [[table=]] to set the stage's table
  # a bit later.
  @table = stalk && stalk.ref.table
  @qualifier = nil
  return
end

Instance Attribute Details

#join_typeObject (readonly)

Returns the value of attribute join_type.



1349
1350
1351
# File 'lib/sql-ferret.rb', line 1349

def join_type
  @join_type
end

#parentObject (readonly)

Returns the value of attribute parent.



1347
1348
1349
# File 'lib/sql-ferret.rb', line 1347

def parent
  @parent
end

#qualifierObject

Returns the value of attribute qualifier.



1352
1353
1354
# File 'lib/sql-ferret.rb', line 1352

def qualifier
  @qualifier
end

#stalkObject (readonly)

Returns the value of attribute stalk.



1348
1349
1350
# File 'lib/sql-ferret.rb', line 1348

def stalk
  @stalk
end

#tableObject

Returns the value of attribute table.



1351
1352
1353
# File 'lib/sql-ferret.rb', line 1351

def table
  @table
end