Sha256: 15d3bd3caa5842483abd9848dc7f162d3e478e19691b2f2c558c41918a67fbd4

Contents?: true

Size: 853 Bytes

Versions: 13

Compression:

Stored size: 853 Bytes

Contents

module Helpers
  def format_author(author)
    parts = []
    parts << author[:name] if author[:name]
    parts << "<a href=\"mailto:#{author[:email]}\">#{author[:email]}</a>" if author[:email]
    if author[:website] and author[:company]
      parts << "<a href=\"#{author[:website]}\">#{author[:company]}</a>"
    elsif author[:company]
      parts << author[:company]
    end
    parts.join(', ')
  end
  
  def format_header(header)
    "#{header[0,1].upcase}#{header[1..-1].downcase}"
  end
  
  def pluralize(cardinality, singular, plural)
    [cardinality, cardinality == 1 ? singular : plural].join(' ')
  end
  
  def format_estimate(cardinality, interval)
    case interval
    when :days
      pluralize(cardinality, 'day', 'days')
    when :weeks
      pluralize(cardinality, 'week', 'days')
    else
      cardinality.to_s
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
saga-0.11.1 templates/default/helpers.rb
saga-0.11.0 templates/default/helpers.rb
saga-0.10.0 templates/default/helpers.rb
saga-0.9.1 templates/default/helpers.rb
saga-0.9.0 templates/default/helpers.rb
saga-0.8.1 templates/default/helpers.rb
saga-0.8.0 templates/default/helpers.rb
saga-0.7.1 templates/default/helpers.rb
saga-0.7.0 templates/default/helpers.rb
saga-0.6.0 templates/default/helpers.rb
saga-0.5.2 templates/default/helpers.rb
saga-0.5.1 templates/default/helpers.rb
saga-0.5.0 templates/default/helpers.rb