class GrepLogic

Singleton class for cure grep Managing the method for matching and printing.

Public Class Methods

new() click to toggle source
Calls superclass method BaseLogic::new
# File lib/cureutils/logic/grep_logic.rb, line 14
def initialize
  super
  @match_method = 'match'
end

Public Instance Methods

option_colorize(colorize) click to toggle source
# File lib/cureutils/logic/grep_logic.rb, line 24
def option_colorize(colorize)
  @str_color = (colorize ? ColorMode::RED : ColorMode::NONE)
end
option_only(only_flag) click to toggle source
# File lib/cureutils/logic/grep_logic.rb, line 19
def option_only(only_flag)
  @only_matched = only_flag
  @match_method = (only_flag ? 'scan' : 'match')
end
pattern(pat, is_exregex = false) click to toggle source
# File lib/cureutils/logic/grep_logic.rb, line 28
def pattern(pat, is_exregex = false)
  if is_exregex
    @pattern = /#{pat}/
    return
  end
  @pattern = /#{Common.pregex2regex(pat)}/
end
print_results() click to toggle source