Class: Context
Direct Known Subclasses
Constant Summary
Constants included from Status
Status::ACTIVE_STATES, Status::INACTIVE_STATES, Status::STATUS_ORDER, Status::STATUS_SYMBOLS, Status::SYMBOLS_STATUS
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<<(action) ⇒ Object
- #delete(action) ⇒ Object
- #include?(action) ⇒ Boolean
-
#initialize(name = 'None') ⇒ Context
constructor
A new instance of Context.
- #to_s ⇒ Object
Methods included from Status
#active, #directory_name, #inactive, #index, #symbol, #with_status
Constructor Details
#initialize(name = 'None') ⇒ Context
Returns a new instance of Context.
28 29 30 31 |
# File 'lib/gtd.rb', line 28 def initialize(name='None') @name = name @actions = [] end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
26 27 28 |
# File 'lib/gtd.rb', line 26 def actions @actions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/gtd.rb', line 26 def name @name end |
Instance Method Details
#<<(action) ⇒ Object
33 34 35 36 |
# File 'lib/gtd.rb', line 33 def <<(action) @actions << action action.context = self end |
#delete(action) ⇒ Object
40 41 42 |
# File 'lib/gtd.rb', line 40 def delete(action) @actions.delete action end |
#include?(action) ⇒ Boolean
37 38 39 |
# File 'lib/gtd.rb', line 37 def include?(action) @actions.include? action end |
#to_s ⇒ Object
43 44 45 |
# File 'lib/gtd.rb', line 43 def to_s "Context #{@name}:\n " + @actions.join("\n ") end |