Skip to content

Instantly share code, notes, and snippets.

@squeedee
Created December 12, 2011 04:42
Show Gist options
  • Select an option

  • Save squeedee/1464954 to your computer and use it in GitHub Desktop.

Select an option

Save squeedee/1464954 to your computer and use it in GitHub Desktop.
def to_json opts = {}
result = {}
each { |attr, message| result[attr] ||= []; result[attr] << message }
result.to_json opts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment