Class: Prettyp::Formatter::HTML::Tidy
Class Method Summary
collapse
Instance Method Summary
collapse
#check_requirement, inherited, inherited_classes
Methods included from Logger
logger, #logger
Class Method Details
.check_requirement ⇒ Object
12
13
14
|
# File 'lib/prettyp/formatter/html/tidy.rb', line 12
def self.check_requirement
!%x|which #{executeable}|.empty?
end
|
.executeable ⇒ Object
10
|
# File 'lib/prettyp/formatter/html/tidy.rb', line 10
def self.executeable; 'tidy'; end
|
.languages ⇒ Object
6
7
8
|
# File 'lib/prettyp/formatter/html/tidy.rb', line 6
def self.languages
['HTML']
end
|
Instance Method Details
16
17
18
19
20
21
22
23
24
25
26
|
# 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 { })
out = File.read(file.path)
out
end
end
end
|