Class: Exa::CLI::Formatters::WebsetItemFormatter
- Inherits:
-
Object
- Object
- Exa::CLI::Formatters::WebsetItemFormatter
- Defined in:
- lib/exa/cli/formatters/webset_item_formatter.rb
Class Method Summary collapse
Class Method Details
.format(item, output_format) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/exa/cli/formatters/webset_item_formatter.rb', line 7 def self.format(item, output_format) case output_format when "json" JSON.generate(item) when "pretty" format_as_pretty(item) when "text" format_as_text(item) when "toon" Exa::CLI::Base.encode_as_toon(item) else raise ArgumentError, "Unknown output format: #{output_format}" end end |
.format_collection(items, output_format) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/exa/cli/formatters/webset_item_formatter.rb', line 22 def self.format_collection(items, output_format) case output_format when "json" JSON.generate(items) when "pretty" format_collection_as_pretty(items) when "text" format_collection_as_text(items) when "toon" Exa::CLI::Base.encode_as_toon(items) else raise ArgumentError, "Unknown output format: #{output_format}" end end |