Sha256: eafec2555b07b15fd83cdb444af94e31ba9f5469f8984d2de2155888e6abd8a1

Contents?: true

Size: 366 Bytes

Versions: 1

Compression:

Stored size: 366 Bytes

Contents

module Separatum
  module Exporters
    class JsonFile
      def initialize(file_name:, pretty_print: false)
        @file_name = file_name
        @pretty_print = pretty_print
      end

      def call(*array)
        str = @pretty_print ? JSON.pretty_generate(array) : JSON.dump(array)
        File.write(@file_name, str)
        array
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
separatum-0.1.0 lib/separatum/exporters/json_file.rb