Class: Abbu::Exporters::JsonExporter

Inherits:
Object
  • Object
show all
Defined in:
lib/abbu/exporters/json_exporter.rb

Instance Method Summary collapse

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_stdoutObject



17
18
19
# File 'lib/abbu/exporters/json_exporter.rb', line 17

def to_stdout
  puts JSON.pretty_generate(payload)
end