Class: TodoNext::Line
- Inherits:
-
Object
- Object
- TodoNext::Line
- Defined in:
- lib/todo_next/line.rb
Instance Attribute Summary collapse
-
#col_offset ⇒ Object
Returns the value of attribute col_offset.
-
#leaf ⇒ Object
Returns the value of attribute leaf.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #branch? ⇒ Boolean
- #comment? ⇒ Boolean
- #example? ⇒ Boolean
-
#initialize(text, col_offset) ⇒ Line
constructor
A new instance of Line.
- #leaf? ⇒ Boolean
- #passed? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(text, col_offset) ⇒ Line
Returns a new instance of Line.
6 7 8 |
# File 'lib/todo_next/line.rb', line 6 def initialize(text, col_offset) @text, @col_offset = text, col_offset end |
Instance Attribute Details
#col_offset ⇒ Object
Returns the value of attribute col_offset.
4 5 6 |
# File 'lib/todo_next/line.rb', line 4 def col_offset @col_offset end |
#leaf ⇒ Object
Returns the value of attribute leaf.
4 5 6 |
# File 'lib/todo_next/line.rb', line 4 def leaf @leaf end |
#text ⇒ Object
Returns the value of attribute text.
4 5 6 |
# File 'lib/todo_next/line.rb', line 4 def text @text end |
Instance Method Details
#blank? ⇒ Boolean
14 15 16 |
# File 'lib/todo_next/line.rb', line 14 def blank? text =~ /^\s*$/ end |
#branch? ⇒ Boolean
28 |
# File 'lib/todo_next/line.rb', line 28 def branch? ; !leaf? end |
#comment? ⇒ Boolean
17 18 19 |
# File 'lib/todo_next/line.rb', line 17 def comment? text =~ /^#/ end |
#example? ⇒ Boolean
23 24 25 |
# File 'lib/todo_next/line.rb', line 23 def example? text =~ /\s*(ex|example)\s*:/ end |
#leaf? ⇒ Boolean
27 |
# File 'lib/todo_next/line.rb', line 27 def leaf? ; leaf end |
#passed? ⇒ Boolean
20 21 22 |
# File 'lib/todo_next/line.rb', line 20 def passed? text =~ /^\s*√/ end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/todo_next/line.rb', line 10 def to_s "<Line# text:#{text}, leaf:#{leaf}, col_offset:#{col_offset}>" end |