Class: Story

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/pivotal-tracker.rb,
lib/pivotal-tracker/story.rb

Overview

initial definition, to avoid circular dependencies when declaring happymappings

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Story

Returns a new instance of Story.



18
19
20
21
22
# File 'lib/pivotal-tracker/story.rb', line 18

def initialize(attributes = {})
  attributes.each do |key, value|
    send("#{key}=", value)
  end
end

Instance Method Details

#to_paramObject



34
35
36
# File 'lib/pivotal-tracker/story.rb', line 34

def to_param
  id.to_s
end

#to_xml(options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/pivotal-tracker/story.rb', line 24

def to_xml(options = {})
  builder = Builder::XmlMarkup.new(options)
  builder.story do |story|
    Story.elements.each do |element_type|
      element = send(element_type.name)
      eval("story.#{element_type.name}(\"#{element.to_s.gsub("\"", "\\\"")}\")") if element
    end
  end
end