Class: SmartTodo::Todo

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_todo/todo.rb

Defined Under Namespace

Classes: CallNode, Compiler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, filepath = "-e") ⇒ Todo

Returns a new instance of Todo.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/smart_todo/todo.rb', line 8

def initialize(source, filepath = "-e")
  @filepath = filepath
  @comment = +""
  @indent = source[/^#(\s+)/, 1].length

  @events = []
  @assignees = []
  @errors = []

  parse(source[(indent + 1)..])
end

Instance Attribute Details

#assigneesObject (readonly)

Returns the value of attribute assignees.



6
7
8
# File 'lib/smart_todo/todo.rb', line 6

def assignees
  @assignees
end

#commentObject (readonly)

Returns the value of attribute comment.



5
6
7
# File 'lib/smart_todo/todo.rb', line 5

def comment
  @comment
end

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'lib/smart_todo/todo.rb', line 6

def errors
  @errors
end

#eventsObject (readonly)

Returns the value of attribute events.



6
7
8
# File 'lib/smart_todo/todo.rb', line 6

def events
  @events
end

#filepathObject (readonly)

Returns the value of attribute filepath.



5
6
7
# File 'lib/smart_todo/todo.rb', line 5

def filepath
  @filepath
end

#indentObject (readonly)

Returns the value of attribute indent.



5
6
7
# File 'lib/smart_todo/todo.rb', line 5

def indent
  @indent
end

Instance Method Details

#<<(source) ⇒ Object



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

def <<(source)
  comment << source
end