class Rugex::String

Public Class Methods

new(text, regex_string) click to toggle source
# File lib/rugex/string.rb, line 7
def initialize(text, regex_string)
  raise EmptyRegexError if regex_string.empty?

  @text, @regex = text, Regexp.new(regex_string)
  @result = (@text =~ @regex) == nil ? '(no matches)' : colorize_text
end

Public Instance Methods

to_s() click to toggle source
# File lib/rugex/string.rb, line 14
def to_s; @result; end