Class: TodoNext::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/todo_next/line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_offsetObject

Returns the value of attribute col_offset.



4
5
6
# File 'lib/todo_next/line.rb', line 4

def col_offset
  @col_offset
end

#leafObject

Returns the value of attribute leaf.



4
5
6
# File 'lib/todo_next/line.rb', line 4

def leaf
  @leaf
end

#textObject

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

Returns:

  • (Boolean)


14
15
16
# File 'lib/todo_next/line.rb', line 14

def blank?
  text =~ /^\s*$/
end

#branch?Boolean

Returns:

  • (Boolean)


28
# File 'lib/todo_next/line.rb', line 28

def branch? ; !leaf? end

#comment?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/todo_next/line.rb', line 17

def comment?
  text =~ /^#/
end

#example?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/todo_next/line.rb', line 23

def example?
  text =~ /\s*(ex|example)\s*:/
end

#leaf?Boolean

Returns:

  • (Boolean)


27
# File 'lib/todo_next/line.rb', line 27

def leaf?   ; leaf   end

#passed?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/todo_next/line.rb', line 20

def passed?
  text =~ /^\s*√/
end

#to_sObject



10
11
12
# File 'lib/todo_next/line.rb', line 10

def to_s
  "<Line# text:#{text}, leaf:#{leaf}, col_offset:#{col_offset}>"
end