Class: Richard::Internal::PatternLine
- Inherits:
-
Object
- Object
- Richard::Internal::PatternLine
- Defined in:
- lib/richard_iii/internal/text_line.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text) ⇒ PatternLine
constructor
A new instance of PatternLine.
-
#matches?(text) ⇒ Boolean
- !
-
expects lines to start and end with /.
Constructor Details
#initialize(text) ⇒ PatternLine
Returns a new instance of PatternLine.
18 19 20 |
# File 'lib/richard_iii/internal/text_line.rb', line 18 def initialize(text) @text = text || fail("You need to supply some text even if it's empty") end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
16 17 18 |
# File 'lib/richard_iii/internal/text_line.rb', line 16 def text @text end |
Instance Method Details
#matches?(text) ⇒ Boolean
- !
-
expects lines to start and end with /
23 24 25 26 |
# File 'lib/richard_iii/internal/text_line.rb', line 23 def matches?(text) regex = Regexp.new(@text.slice(1,(@text.size-2))) false == regex.match(text).nil? end |