Class: Rgr::Searcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rgr/searcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search) ⇒ Searcher

Returns a new instance of Searcher.



8
9
10
# File 'lib/rgr/searcher.rb', line 8

def initialize(search)
  @search_ast = parser_class.parse(search)
end

Instance Attribute Details

#search_astObject (readonly)

Returns the value of attribute search_ast.



6
7
8
# File 'lib/rgr/searcher.rb', line 6

def search_ast
  @search_ast
end

Instance Method Details

#search_file(file) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rgr/searcher.rb', line 12

def search_file(file)
  if ast = parse_file(file)
    search_node_rec(ast, search_ast)
  else
    []
  end
end