Class: Fack

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ignoreObject

Returns the value of attribute ignore.



5
6
7
# File 'lib/fack.rb', line 5

def ignore
  @ignore
end

Instance Method Details

#helpObject



7
8
9
# File 'lib/fack.rb', line 7

def help
  puts "To use: fack <search_string>"
end


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


26
27
28
# File 'lib/fack.rb', line 26

def print_find(start, file)
  Dir.glob('**/*') { |f| print_check(f, file) }
end