Class: Rgr::Searcher
- Inherits:
-
Object
- Object
- Rgr::Searcher
- Defined in:
- lib/rgr/searcher.rb
Instance Attribute Summary collapse
-
#search_ast ⇒ Object
readonly
Returns the value of attribute search_ast.
Instance Method Summary collapse
-
#initialize(search) ⇒ Searcher
constructor
A new instance of Searcher.
- #search_file(file) ⇒ Object
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_ast ⇒ Object (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 |