Class: Sah::Formatter
- Inherits:
-
Object
- Object
- Sah::Formatter
- Defined in:
- lib/sah/formatter.rb
Defined Under Namespace
Modules: Format
Instance Method Summary collapse
-
#initialize(format: "table") ⇒ Formatter
constructor
A new instance of Formatter.
- #render(*args) ⇒ Object
Constructor Details
#initialize(format: "table") ⇒ Formatter
Returns a new instance of Formatter.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/sah/formatter.rb', line 6 def initialize(format: "table") @format = case format when "table" Format::Hirb when "json" Format::Json else abort "format must be set to json or table: #{format}" end end |
Instance Method Details
#render(*args) ⇒ Object
17 18 19 |
# File 'lib/sah/formatter.rb', line 17 def render(*args) @format.render(*args) end |