Class: Gitlang::JsonFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlang/formatters/json_formatter.rb

Overview

A class for formatting various results to JSON format.

Instance Method Summary collapse

Instance Method Details

#format(organization_name, languages) ⇒ Object

Create a JSON formatted string for the data provided.

Examples:

format('acme', { c: 30.0, ruby: 70.0 })

Parameters:

  • organization_name (String)
  • languages (Hash)


13
14
15
16
# File 'lib/gitlang/formatters/json_formatter.rb', line 13

def format(organization_name, languages)
  JSON.pretty_generate(organization: organization_name,
                       languages: languages)
end