Sha256: a403bbb77a112f56f53c804fcd9f0410560823fa839faaf95f118fde3933cd2f

Contents?: true

Size: 921 Bytes

Versions: 4

Compression:

Stored size: 921 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")
  end
  
  def format_definition(definition)
    [definition[:title], definition[:definition]].join(': ')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
saga-0.7.1 templates/saga/helpers.rb
saga-0.7.0 templates/saga/helpers.rb
saga-0.6.0 templates/saga/helpers.rb
saga-0.5.2 templates/saga/helpers.rb