Class: Klipbook::Commands::ToJson
- Inherits:
-
Object
- Object
- Klipbook::Commands::ToJson
- Defined in:
- lib/klipbook/commands/tojson.rb
Instance Method Summary collapse
- #call(output_file_path, force, message_stream = $stdout) ⇒ Object
-
#initialize(books, book_file) ⇒ ToJson
constructor
A new instance of ToJson.
Constructor Details
Instance Method Details
#call(output_file_path, force, message_stream = $stdout) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/klipbook/commands/tojson.rb', line 8 def call(output_file_path, force, =$stdout) .puts "\nWriting book json to file: #{output_file_path}" @book_file.add_books(@books, force) File.open(output_file_path, 'w') do |output_file| output_file.puts @book_file.to_json end end |