Class: SexpPath::RubyQueryBuilder

Inherits:
SexpQueryBuilder show all
Defined in:
lib/sexp_path/ruby_query_builder.rb

Class Method Summary collapse

Methods inherited from SexpQueryBuilder

all, any, atom, child, do, include, is_not, m, remaining, s, t, wild

Class Method Details

._assignment(name = nil, bind = 'assignment') ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sexp_path/ruby_query_builder.rb', line 25

def _assignment(name=nil, bind='assignment')
  term = v(name, bind)
  tag = variable_tag(name, :iasgn, :lasgn)

  s(tag, term)     | # declaration 
  s(tag, term, _)  | # assignment
  (                  # block arument
    t(:args) & 
    ( # note this last case is wrong for regexps
      SexpPath::Matcher::Block.new{|s| s[1..-1].any?{|a| a == name}} % bind
    )
  )
end

._call(name = nil, bind = 'call') ⇒ Object



12
13
14
# File 'lib/sexp_path/ruby_query_builder.rb', line 12

def _call(name=nil, bind='call')
  s(:call, _, v(name, bind), _)
end

._class(name = nil, bind = 'class') ⇒ Object



16
17
18
# File 'lib/sexp_path/ruby_query_builder.rb', line 16

def _class(name=nil, bind='class')
  s(:class, v(name, bind), _, _)
end

._class_method(name = nil, bind = 'class_method') ⇒ Object



8
9
10
# File 'lib/sexp_path/ruby_query_builder.rb', line 8

def _class_method(name=nil, bind='class_method')
  s(:defs, v(name, bind), _, _)
end

._method(name = nil, bind = 'method') ⇒ Object



4
5
6
# File 'lib/sexp_path/ruby_query_builder.rb', line 4

def _method(name=nil, bind='method')
  s(:defn, v(name, bind), _, _)
end

._variable(name = nil, bind = 'variable') ⇒ Object



20
21
22
23
# File 'lib/sexp_path/ruby_query_builder.rb', line 20

def _variable(name=nil, bind='variable')
  tag = variable_tag(name, :ivar, :lvar)
  s(tag, v(name, var))
end