Class: PowerAssert::Parser (Ruby 2.7.5)
Description: Class : PowerAssert::Parser - Ruby 2.7.5

### Home Classes Methods

### In Files

- power_assert-1.1.7/lib/power_assert/parser.rb

### Parent

Object

### Namespace

- CLASS PowerAssert::Parser::Branch
- CLASS PowerAssert::Parser::DummyParser

### Methods

- ::new
- #call_paths
- #idents
- #method_id_set

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- PowerAssert
- PowerAssert::BlockContext
- PowerAssert::Configuration
- PowerAssert::Context
- PowerAssert::Empty
- PowerAssert::Formatter
- PowerAssert::InspectedValue
- PowerAssert::Parser
- PowerAssert::Parser::Branch
- PowerAssert::Parser::DummyParser
- PowerAssert::SafeInspectable
- PowerAssert::TraceContext

No matching classes.

# PowerAssert::Parser

### Constants

AND_OR_OPS
DUMMY
Ident
MID2SRCTXT

### Attributes

binding[R]
line[R]
lineno[R]
path[R]

### Public Class Methods

new(line, path, lineno, binding, assertion_method_name = nil, assertion_proc = nil) click to toggle source

                   # File power_assert-1.1.7/lib/power_assert/parser.rb, line 9
    def initialize(line, path, lineno, binding, assertion_method_name = nil, assertion_proc = nil)
      @line = line
      @line_for_parsing = (valid_syntax?(line) ? line : slice_expression(line)).b
      @path = path
      @lineno = lineno
      @binding = binding
      @proc_local_variables = binding.eval('local_variables').map(&:to_s)
      @assertion_method_name = assertion_method_name
      @assertion_proc = assertion_proc
    end

### Public Instance Methods

call_paths() click to toggle source

                   # File power_assert-1.1.7/lib/power_assert/parser.rb, line 24
    def call_paths
      collect_paths(idents).uniq
    end

idents() click to toggle source

                   # File power_assert-1.1.7/lib/power_assert/parser.rb, line 20
    def idents
      @idents ||= extract_idents(Ripper.sexp(@line_for_parsing))
    end

method_id_set() click to toggle source

                   # File power_assert-1.1.7/lib/power_assert/parser.rb, line 28
    def method_id_set
      methods = idents.flatten.find_all {|i| i.type == :method }
      @method_id_set ||= methods.map(&:name).map(&:to_sym).each_with_object({}) {|i, h| h[i] = true }
    end