Module: W3cApi::Commands::OutputFormatter

Included in:
Affiliation, Ecosystem, Group, Participation, Series, Specification, SpecificationVersion, Translation, User
Defined in:
lib/w3c_api/commands/output_formatter.rb

Instance Method Summary collapse

Instance Method Details

#output_results(results, format) ⇒ Object

Format and output results based on the specified format



7
8
9
10
11
12
13
14
15
# File 'lib/w3c_api/commands/output_formatter.rb', line 7

def output_results(results, format)
  case format
  when "yaml"
    puts results.to_yaml
  else
    # Default to JSON if format is not recognized
    puts results.to_json
  end
end