Class: RSpock::AST::Parser::StatementParser
- Inherits:
-
Object
- Object
- RSpock::AST::Parser::StatementParser
- Includes:
- ASTTransform::TransformationHelper
- Defined in:
- lib/rspock/ast/parser/statement_parser.rb
Overview
Classifies raw Ruby AST statements into RSpock node types for Then/Expect blocks.
- Assignments pass through as raw AST (no wrapping).
- Binary operators (==, !=, =~, etc.) become :rspock_binary_statement nodes.
- Everything else becomes :rspock_statement nodes with the original source text captured.
Constant Summary collapse
- BINARY_OPERATORS =
%i[== != =~ !~ > < >= <=].freeze
- ASSIGNMENT_TYPES =
%i[lvasgn masgn op_asgn or_asgn and_asgn].freeze
Instance Method Summary collapse
Instance Method Details
#parse(node) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rspock/ast/parser/statement_parser.rb', line 19 def parse(node) return build_raises(node) if raises_condition?(node) return node if assignment?(node) return build_binary_statement(node) if binary_statement?(node) build_statement(node) end |