Class: Fack
- Inherits:
-
Object
- Object
- Fack
- Defined in:
- lib/fack.rb
Instance Attribute Summary collapse
-
#ignore ⇒ Object
Returns the value of attribute ignore.
Instance Method Summary collapse
Instance Attribute Details
#ignore ⇒ Object
Returns the value of attribute ignore.
5 6 7 |
# File 'lib/fack.rb', line 5 def ignore @ignore end |
Instance Method Details
#help ⇒ Object
7 8 9 |
# File 'lib/fack.rb', line 7 def help puts "To use: fack <search_string>" end |
#print_check(a, b) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fack.rb', line 11 def print_check(a, b) search=nil if @ignore search = a.to_enum(:scan, /#{b}/i).map { Regexp.last_match } #a.match(/#{b}/i) else search = a.to_enum(:scan, /#{b}/).map { Regexp.last_match } #match(/#{b}/) end search.each do |s| puts a.gsub(/#{s.to_s}/, s.to_s.colorize(:red)) end end |
#print_find(start, file) ⇒ Object
26 27 28 |
# File 'lib/fack.rb', line 26 def print_find(start, file) Dir.glob('**/*') { |f| print_check(f, file) } end |