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.
21 22 23 24 25 26 27 28 29 |
# File 'lib/glark/match/spec.rb', line 21 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
14 15 16 |
# File 'lib/glark/match/spec.rb', line 14 def expr @expr end |
#extended ⇒ Object
whether to use extended regular expressions
15 16 17 |
# File 'lib/glark/match/spec.rb', line 15 def extended @extended end |
#extract_matches ⇒ Object
Returns the value of attribute extract_matches.
16 17 18 |
# File 'lib/glark/match/spec.rb', line 16 def extract_matches @extract_matches end |
#ignorecase ⇒ Object
match case
17 18 19 |
# File 'lib/glark/match/spec.rb', line 17 def ignorecase @ignorecase end |
#whole_lines ⇒ Object
true means patterns must match the entire line
18 19 20 |
# File 'lib/glark/match/spec.rb', line 18 def whole_lines @whole_lines end |
#whole_words ⇒ Object
true means all patterns are ‘b’ed front and back
19 20 21 |
# File 'lib/glark/match/spec.rb', line 19 def whole_words @whole_words end |
Instance Method Details
#create_expression_factory ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/glark/match/spec.rb', line 31 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
43 44 45 |
# File 'lib/glark/match/spec.rb', line 43 def read_expression args, warn_option = false @expr = create_expression_factory.make_expression args, warn_option end |
#set_text_color(index, text_color) ⇒ Object
55 56 57 |
# File 'lib/glark/match/spec.rb', line 55 def set_text_color index, text_color @colors.text_colors[index] = text_color end |
#set_text_colors(text_colors) ⇒ Object
51 52 53 |
# File 'lib/glark/match/spec.rb', line 51 def set_text_colors text_colors @colors.text_colors = text_colors end |
#text_colors ⇒ Object
47 48 49 |
# File 'lib/glark/match/spec.rb', line 47 def text_colors @colors.text_colors end |