Class: Abbu::Exporters::JsonExporter
- Inherits:
-
Object
- Object
- Abbu::Exporters::JsonExporter
- Defined in:
- lib/abbu/exporters/json_exporter.rb
Instance Method Summary collapse
-
#initialize(contacts) ⇒ JsonExporter
constructor
A new instance of JsonExporter.
- #to_file(path) ⇒ Object
- #to_stdout ⇒ Object
Constructor Details
#initialize(contacts) ⇒ JsonExporter
Returns a new instance of JsonExporter.
9 10 11 |
# File 'lib/abbu/exporters/json_exporter.rb', line 9 def initialize(contacts) @contacts = contacts end |
Instance Method Details
#to_file(path) ⇒ Object
13 14 15 |
# File 'lib/abbu/exporters/json_exporter.rb', line 13 def to_file(path) File.write(path, JSON.pretty_generate(payload)) end |
#to_stdout ⇒ Object
17 18 19 |
# File 'lib/abbu/exporters/json_exporter.rb', line 17 def to_stdout puts JSON.pretty_generate(payload) end |