Class: Taskr::Models::TaskAction
- Inherits:
-
Base
- Object
- Base
- Taskr::Models::TaskAction
- Defined in:
- lib/taskr/models.rb
Instance Method Summary collapse
- #action_class ⇒ Object
- #action_class=(class_name) ⇒ Object
- #description ⇒ Object
- #to_s ⇒ Object
- #to_xml(options = {}) ⇒ Object
Instance Method Details
#action_class ⇒ Object
179 180 181 |
# File 'lib/taskr/models.rb', line 179 def action_class self[:action_class_name].constantize end |
#action_class=(class_name) ⇒ Object
171 172 173 174 175 176 177 |
# File 'lib/taskr/models.rb', line 171 def action_class=(class_name) if class_name.kind_of? Class self[:action_class_name] = class_name.to_s else self[:action_class_name] = class_name end end |
#description ⇒ Object
183 184 185 |
# File 'lib/taskr/models.rb', line 183 def description action_class.description end |
#to_s ⇒ Object
202 203 204 |
# File 'lib/taskr/models.rb', line 202 def to_s "#{self.class.name.demodulize}(#{action_class})" end |
#to_xml(options = {}) ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/taskr/models.rb', line 187 def to_xml( = {}) [:indent] ||= 2 xml = [:builder] ||= Builder::XmlMarkup.new(:indent => [:indent]) xml.instruct! unless [:skip_instruct] xml.tag!('task-action', :type => self.class) do xml.tag!('id', {:type => 'integer'}, id) xml.tag!('action-class-name', action_class_name) xml.tag!('order', {:type => 'integer'}, order) unless order.blank? xml.tag!('task-id', {:type => 'integer'}, task_id) xml.tag!('action-parameters', {:type => 'array'}) do action_parameters.each {|ap| ap.to_xml()} end end end |