Class: RSpock::AST::Parser::WhereBlock

Inherits:
Block
  • Object
show all
Defined in:
lib/rspock/ast/parser/where_block.rb

Defined Under Namespace

Classes: MalformedError

Instance Attribute Summary

Attributes inherited from Block

#node, #type

Instance Method Summary collapse

Methods inherited from Block

#<<, #can_start?, #children, #range, #succession_error_msg, #successors, #valid_successor?

Constructor Details

#initialize(node) ⇒ WhereBlock

Returns a new instance of WhereBlock.



10
11
12
# File 'lib/rspock/ast/parser/where_block.rb', line 10

def initialize(node)
  super(:Where, node)
end

Instance Method Details

#can_end?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/rspock/ast/parser/where_block.rb', line 28

def can_end?
  true
end

#dataObject



18
19
20
# File 'lib/rspock/ast/parser/where_block.rb', line 18

def data
  @data ||= parse_data
end

#headerObject



14
15
16
# File 'lib/rspock/ast/parser/where_block.rb', line 14

def header
  @header ||= parse_header
end

#to_rspock_nodeObject



22
23
24
25
26
# File 'lib/rspock/ast/parser/where_block.rb', line 22

def to_rspock_node
  header_node = s(:rspock_where_header, *header.map { |col| s(:sym, col) })
  data_nodes = data.map { |row| s(:array, *row) }
  s(:rspock_where, header_node, *data_nodes)
end