Class: Ghaki::Match::Finder
- Inherits:
-
Object
- Object
- Ghaki::Match::Finder
- Defined in:
- lib/ghaki/match/finder.rb
Overview
Match against list of regular expressions.
Instance Attribute Summary collapse
-
#lookups ⇒ Object
Returns the value of attribute lookups.
Instance Method Summary collapse
-
#initialize(arg_rx_list) ⇒ Finder
constructor
Given list of regular expressions.
-
#match_lines(lines) ⇒ Object
Matches any line against saved regexps.
-
#match_text(text) ⇒ Object
Matches string against saved regexps.
Constructor Details
#initialize(arg_rx_list) ⇒ Finder
Given list of regular expressions
10 11 12 |
# File 'lib/ghaki/match/finder.rb', line 10 def initialize arg_rx_list @lookups = arg_rx_list end |
Instance Attribute Details
#lookups ⇒ Object
Returns the value of attribute lookups.
7 8 9 |
# File 'lib/ghaki/match/finder.rb', line 7 def lookups @lookups end |
Instance Method Details
#match_lines(lines) ⇒ Object
Matches any line against saved regexps.
23 24 25 26 27 28 |
# File 'lib/ghaki/match/finder.rb', line 23 def match_lines lines lines.each do |text| return true if self.match_text( text ) end false end |
#match_text(text) ⇒ Object
Matches string against saved regexps.
15 16 17 18 19 20 |
# File 'lib/ghaki/match/finder.rb', line 15 def match_text text @lookups.each do |rx_curr| return true if text =~ rx_curr end false end |