Class: Actions
- Inherits:
-
Object
- Object
- Actions
- Defined in:
- lib/startask.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #[](i) ⇒ Object
- #find(id) ⇒ Object
- #import(a) ⇒ Object
-
#initialize(obj = nil, callback = nil) ⇒ Actions
constructor
A new instance of Actions.
- #log ⇒ Object
- #to_s ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(obj = nil, callback = nil) ⇒ Actions
Returns a new instance of Actions.
102 103 104 105 106 107 |
# File 'lib/startask.rb', line 102 def initialize(obj=nil, callback=nil) @a = read obj if obj.is_a? Rexle::Recordset @callback = callback end |
Instance Attribute Details
#status ⇒ Object
Returns the value of attribute status.
100 101 102 |
# File 'lib/startask.rb', line 100 def status @status end |
Instance Method Details
#[](i) ⇒ Object
127 128 129 |
# File 'lib/startask.rb', line 127 def [](i) @a[i] end |
#find(id) ⇒ Object
109 110 111 |
# File 'lib/startask.rb', line 109 def find(id) @a.find {|x| x.find id} end |
#import(a) ⇒ Object
113 114 115 116 117 118 119 120 121 |
# File 'lib/startask.rb', line 113 def import(a) @a = a.map do |x| x.is_a?(String) ? ActionItem.new(x, @callback) : Actions.new(@callback).import(x) end return self end |
#log ⇒ Object
123 124 125 |
# File 'lib/startask.rb', line 123 def log() @a.flat_map {|x| x.log(detail: true)} end |
#to_s ⇒ Object
131 132 133 |
# File 'lib/startask.rb', line 131 def to_s() @a.each(&:to_s) end |
#to_xml ⇒ Object
135 136 137 138 139 |
# File 'lib/startask.rb', line 135 def to_xml() Rexle::Element.new( :actions, value: @a.map(&:to_xml).join) #@a.map(&:to_xml) end |