Sha256: 8c1d58adf96f55a9672d3beb54dd24aae22d1d065aeb1db1d8862eb249e43203

Contents?: true

Size: 484 Bytes

Versions: 17

Compression:

Stored size: 484 Bytes

Contents

require 'htmlbeautifier'

module Eac
  class Htmlbeautifier
    def self.beautify(string)
      ::HtmlBeautifier.beautify(string, tab_stops: 2) + "\n"
    end

    def self.file_beautified?(file)
      input = File.read(file)
      input == beautify(input)
    end

    def self.beautify_file(file)
      input = File.read(file)
      output = beautify(input)
      if input == output
        false
      else
        File.write(file, output)
        true
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
eac_rails_utils-0.8.0 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.7.1 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.7.0 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.6.0 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.5.0 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.4.0 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.3.0 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.2.2 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.2.1 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.2.0 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.1.15 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.1.14 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.1.13 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.1.12 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.1.11 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.1.10 lib/eac/htmlbeautifier.rb
eac_rails_utils-0.0.1 lib/eac/htmlbeautifier.rb