Class: Xail::ReplaceFilter
- Inherits:
-
AbstractFilter
- Object
- AbstractFilter
- Xail::ReplaceFilter
- Defined in:
- lib/xail/filter.rb
Instance Method Summary collapse
-
#initialize(regexp) ⇒ ReplaceFilter
constructor
A new instance of ReplaceFilter.
- #streamLine(line) ⇒ Object
Methods inherited from AbstractFilter
Constructor Details
#initialize(regexp) ⇒ ReplaceFilter
Returns a new instance of ReplaceFilter.
174 175 176 |
# File 'lib/xail/filter.rb', line 174 def initialize(regexp) @regexp = regexp end |
Instance Method Details
#streamLine(line) ⇒ Object
178 179 180 181 182 183 184 185 |
# File 'lib/xail/filter.rb', line 178 def streamLine(line) # why fold when you can iterate final = line @regexp.each_pair do |patt,val| final.gsub!(patt,val) end final end |