Class: ActionItem
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#log ⇒ Object
readonly
Returns the value of attribute log.
Instance Method Summary collapse
- #done ⇒ Object (also: #completed)
-
#initialize(s, callback = nil) ⇒ ActionItem
constructor
A new instance of ActionItem.
- #started ⇒ Object
- #status ⇒ Object
- #status=(status) ⇒ Object
- #stopped ⇒ Object
- #to_s ⇒ Object
- #to_xml ⇒ Object
Methods included from RecordHelper
Constructor Details
#initialize(s, callback = nil) ⇒ ActionItem
Returns a new instance of ActionItem.
27 28 29 30 31 32 33 34 |
# File 'lib/startask.rb', line 27 def initialize(s, callback=nil) @id = generate_id() @title = s @log = [] @callback = callback end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
25 26 27 |
# File 'lib/startask.rb', line 25 def id @id end |
#log ⇒ Object (readonly)
Returns the value of attribute log.
25 26 27 |
# File 'lib/startask.rb', line 25 def log @log end |
Instance Method Details
#done ⇒ Object Also known as: completed
36 37 38 |
# File 'lib/startask.rb', line 36 def done() logaction :completed end |
#started ⇒ Object
46 47 48 |
# File 'lib/startask.rb', line 46 def started() logaction :started end |
#status ⇒ Object
50 51 52 |
# File 'lib/startask.rb', line 50 def status() @log.last ? @log.last : [] end |
#status=(status) ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/startask.rb', line 58 def status=(status) case status when :done done() when :started started() end end |
#stopped ⇒ Object
54 55 56 |
# File 'lib/startask.rb', line 54 def stopped() logaction :stopped end |
#to_s ⇒ Object
42 43 44 |
# File 'lib/startask.rb', line 42 def to_s() @title end |
#to_xml ⇒ Object
69 70 71 72 73 74 |
# File 'lib/startask.rb', line 69 def to_xml() h = {id: @id, status: status().join(' ')} Rexle::Element.new(:action, attributes: h, value: @title) end |