Sha256: 527918c30f9b06d5f8dcf14977f7d5cd0d89c68df834704b42ca918f71e9056f

Contents?: true

Size: 923 Bytes

Versions: 2

Compression:

Stored size: 923 Bytes

Contents

module Helpers
  def format_author(author)
    [:name, :email, :company, :website].map do |key|
      author[key]
    end.compact.join(', ')
  end
  
  def format_estimate(cardinality, interval)
    case interval
    when :days
      "#{cardinality}d"
    when :weeks
      "#{cardinality}w"
    else
      cardinality.to_s
    end
  end
  
  def format_story(story)
    story_attributes = []
    story_attributes << "##{story[:id]}" if story[:id]
    story_attributes << story[:status] if story[:status]
    story_attributes << format_estimate(*story[:estimate]) if story[:estimate]
    story_attributes << "i#{story[:iteration]}" if story[:iteration]
    
    parts = [[story[:description], story_attributes.join(' ')].join(' - ')]
    parts << "  #{story[:notes]}" if story[:notes]
    parts.join("\n\n")
  end
  
  def format_definition(definition)
    [definition[:title], definition[:definition]].join(': ')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saga-0.5.1 templates/saga/helpers.rb
saga-0.5.0 templates/saga/helpers.rb