Class: Rugex::String
Instance Method Summary collapse
-
#initialize(text, regex_string) ⇒ String
constructor
A new instance of String.
- #to_s ⇒ Object
Constructor Details
#initialize(text, regex_string) ⇒ String
Returns a new instance of String.
7 8 9 10 11 12 |
# 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 |
Instance Method Details
#to_s ⇒ Object
14 |
# File 'lib/rugex/string.rb', line 14 def to_s; @result; end |