class Prettyp::Formatter::HTML::Tidy
Public Class Methods
check_requirement()
click to toggle source
# File lib/prettyp/formatter/html/tidy.rb, line 12 def self.check_requirement !%x|which #{executeable}|.empty? end
executeable()
click to toggle source
# File lib/prettyp/formatter/html/tidy.rb, line 10 def self.executeable; 'tidy'; end
languages()
click to toggle source
# File lib/prettyp/formatter/html/tidy.rb, line 6 def self.languages ['HTML'] end
Public Instance Methods
format(input, language)
click to toggle source
# File lib/prettyp/formatter/html/tidy.rb, line 16 def format input, language with_file(input) do |file| with_tempfile '' do |tmp| out = execute_command("#{self.class.executeable} -im #{file.path} -f #{tmp.path} -q", #on_error: Proc.new { |output| raise FormatError, output }) on_error: Proc.new { }) out = File.read(file.path) out end end end