Class: Task
Overview
<?xml version=“1.0” encoding=“UTF-8”?>
<task>
<id type="integer">TASK_ID</id>
<description>find shields</description>
<position>1</position>
<complete>false</complete>
<created_at type="datetime">2008/12/10 00:00:00 UTC</created_at>
</task>
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Task
constructor
A new instance of Task.
- #to_param ⇒ Object
- #to_xml(options = {}) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Task
19 20 21 22 23 |
# File 'lib/pivotal-tracker/task.rb', line 19 def initialize(attributes = {}) attributes.each do |key, value| send("#{key}=", value) end end |
Instance Method Details
#to_param ⇒ Object
35 36 37 |
# File 'lib/pivotal-tracker/task.rb', line 35 def to_param id.to_s end |
#to_xml(options = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/pivotal-tracker/task.rb', line 25 def to_xml( = {}) builder = Builder::XmlMarkup.new() builder.task do |task| Task.elements.each do |element_type| element = send(element_type.name) eval("task.#{element_type.name}(\"#{element.to_s.gsub("\"", "\\\"")}\")") if element end end end |