Class: Glark::MatchSpec
- Inherits:
-
Object
- Object
- Glark::MatchSpec
- Defined in:
- lib/glark/match/spec.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#expr ⇒ Object
the expression to be evaluated.
-
#extended ⇒ Object
whether to use extended regular expressions.
-
#extract_matches ⇒ Object
Returns the value of attribute extract_matches.
-
#ignorecase ⇒ Object
match case.
-
#whole_lines ⇒ Object
true means patterns must match the entire line.
-
#whole_words ⇒ Object
true means all patterns are ‘b’ed front and back.
Instance Method Summary collapse
- #create_expression_factory ⇒ Object
-
#initialize(colors) ⇒ MatchSpec
constructor
A new instance of MatchSpec.
- #read_expression(args, warn_option = false) ⇒ Object
- #set_text_color(index, text_color) ⇒ Object
- #set_text_colors(text_colors) ⇒ Object
- #text_colors ⇒ Object
Constructor Details
#initialize(colors) ⇒ MatchSpec
Returns a new instance of MatchSpec.
20 21 22 23 24 25 26 27 28 |
# File 'lib/glark/match/spec.rb', line 20 def initialize colors @colors = colors @expr = nil @extended = false @extract_matches = false @ignorecase = false @whole_lines = false @whole_words = false end |
Instance Attribute Details
#expr ⇒ Object
the expression to be evaluated
13 14 15 |
# File 'lib/glark/match/spec.rb', line 13 def expr @expr end |
#extended ⇒ Object
whether to use extended regular expressions
14 15 16 |
# File 'lib/glark/match/spec.rb', line 14 def extended @extended end |
#extract_matches ⇒ Object
Returns the value of attribute extract_matches.
15 16 17 |
# File 'lib/glark/match/spec.rb', line 15 def extract_matches @extract_matches end |
#ignorecase ⇒ Object
match case
16 17 18 |
# File 'lib/glark/match/spec.rb', line 16 def ignorecase @ignorecase end |
#whole_lines ⇒ Object
true means patterns must match the entire line
17 18 19 |
# File 'lib/glark/match/spec.rb', line 17 def whole_lines @whole_lines end |
#whole_words ⇒ Object
true means all patterns are ‘b’ed front and back
18 19 20 |
# File 'lib/glark/match/spec.rb', line 18 def whole_words @whole_words end |
Instance Method Details
#create_expression_factory ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/glark/match/spec.rb', line 30 def create_expression_factory exprargs = Hash.new exprargs[:extended] = @extended exprargs[:extract_matches] = @extract_matches exprargs[:ignorecase] = @ignorecase exprargs[:text_colors] = text_colors exprargs[:whole_lines] = @whole_lines exprargs[:whole_words] = @whole_words ExpressionFactory.new exprargs end |
#read_expression(args, warn_option = false) ⇒ Object
42 43 44 |
# File 'lib/glark/match/spec.rb', line 42 def read_expression args, warn_option = false @expr = create_expression_factory.make_expression args, warn_option end |
#set_text_color(index, text_color) ⇒ Object
54 55 56 |
# File 'lib/glark/match/spec.rb', line 54 def set_text_color index, text_color @colors.text_colors[index] = text_color end |
#set_text_colors(text_colors) ⇒ Object
50 51 52 |
# File 'lib/glark/match/spec.rb', line 50 def set_text_colors text_colors @colors.text_colors = text_colors end |
#text_colors ⇒ Object
46 47 48 |
# File 'lib/glark/match/spec.rb', line 46 def text_colors @colors.text_colors end |