Sha256: 1bea6503222afb489c298b43e5f164d2272ac9dd197413fd09a49cafb1140319

Contents?: true

Size: 775 Bytes

Versions: 4

Compression:

Stored size: 775 Bytes

Contents

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] && 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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
saga-0.13.2 templates/default/helpers.rb
saga-0.13.1 templates/default/helpers.rb
saga-0.13.0 templates/default/helpers.rb
saga-0.12.2 templates/default/helpers.rb