lib/statusz.rb in statusz-0.1.0.pre vs lib/statusz.rb in statusz-0.1.0.pre.2
- old
+ new
@@ -52,10 +52,14 @@
# @private
def self.render(fields, format)
case format
when :text
- fields.map { |name, value| "#{name}:\n#{value}" }.join("\n\n")
+ # For readability, it's nice to have the massive 'all commits' field be the last one.
+ all_commits = fields.delete "all commits"
+ fields_with_commits_last = fields.map { |name, value| [name, value] }
+ fields_with_commits_last << all_commits if all_commits
+ fields_with_commits_last.map { |name, value| "#{name}:\n#{value}" }.join("\n\n")
when :json
fields.to_json
when :html
html_values = fields.reduce({}) do |h, (field, value)|
pair = (field == "all commits") ? { field => value.split("\n") } : { field => CGI.escapeHTML(value) }