Class: Actions

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#statusObject

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

#logObject



123
124
125
# File 'lib/startask.rb', line 123

def log()
  @a.flat_map {|x| x.log(detail: true)}
end

#to_sObject



131
132
133
# File 'lib/startask.rb', line 131

def to_s()
  @a.each(&:to_s)
end

#to_xmlObject



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