Class: OrgMode::Node

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



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

def initialize
  @parent = nil
  @children = []
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



18
19
20
# File 'lib/org_mode.rb', line 18

def children
  @children
end

#contentObject

Returns the value of attribute content.



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

def content
  @content
end

#dateObject

Returns the value of attribute date.



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

def date
  @date
end

#date_end_timeObject

Returns the value of attribute date_end_time.



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

def date_end_time
  @date_end_time
end

#date_start_timeObject

Returns the value of attribute date_start_time.



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

def date_start_time
  @date_start_time
end

#parentObject

Returns the value of attribute parent.



18
19
20
# File 'lib/org_mode.rb', line 18

def parent
  @parent
end

#starsObject

Returns the value of attribute stars.



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

def stars
  @stars
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

#todo_stateObject

Returns the value of attribute todo_state.



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

def todo_state
  @todo_state
end

Instance Method Details

#appointment?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/org_mode.rb', line 37

def appointment?
  !!( date_start_time || date_end_time )
end

#done?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/org_mode.rb', line 45

def done?
  todo_state == 'DONE'
end

#indentObject



25
26
27
# File 'lib/org_mode.rb', line 25

def indent 
  stars + 1
end

#open?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/org_mode.rb', line 41

def open?
  not done?
end

#root_node?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/org_mode.rb', line 29

def root_node?
  stars == 1
end

#scheduled?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/org_mode.rb', line 33

def scheduled?
  !date.nil?
end