Sha256: c6949009f138237606516edb195320ddff5930674ba843c1b67842f65a386f0c

Contents?: true

Size: 421 Bytes

Versions: 2

Compression:

Stored size: 421 Bytes

Contents

# frozen_string_literal: true

module Fixturizer
  module Serializers
    class Json < Template
      def apply
        result = if @options[:raw]
                   @data.to_json
                 else
                   JSON.pretty_generate(@data).concat("\n")
                 end
        return result unless @options[:to_file].is_a?(String)

        write_file(@options[:to_file], result)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fixturizer-0.4.4 lib/fixturizer/serializers/json.rb
fixturizer-0.4.3 lib/fixturizer/serializers/json.rb