Sha256: b43a76b244c526d03350ad287c49c4bb2630a64552ebe9c122bbe90f19138044

Contents?: true

Size: 435 Bytes

Versions: 4

Compression:

Stored size: 435 Bytes

Contents

module Munge
  module Core
    class Write
      def initialize(output:)
        @output = output
      end

      def write(relpath, content)
        abspath = File.join(@output, relpath)

        FileUtils.mkdir_p(File.dirname(abspath))

        if File.exist?(abspath) && File.read(abspath) == content
          return false
        else
          File.write(abspath, content)
          true
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
munge-0.5.0 lib/munge/core/write.rb
munge-0.5.0.beta1 lib/munge/core/write.rb
munge-0.4.0 lib/munge/core/write.rb
munge-0.3.0 lib/munge/core/write.rb