Class: Prettyp::Formatter::XML::Xmllint
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
11
12
13
|
# File 'lib/prettyp/formatter/xml/xmllint.rb', line 11
def self.check_requirement
!%x|which #{executeable}|.empty?
end
|
.executeable ⇒ Object
10
|
# File 'lib/prettyp/formatter/xml/xmllint.rb', line 10
def self.executeable; 'xmllint'; end
|
.languages ⇒ Object
6
7
8
|
# File 'lib/prettyp/formatter/xml/xmllint.rb', line 6
def self.languages
[:xml, :html]
end
|
Instance Method Details
15
16
17
18
19
20
21
|
# File 'lib/prettyp/formatter/xml/xmllint.rb', line 15
def format input, language
= '--html' if language.eql? :html
with_file(input) do |file|
out = execute_command("cat #{file.path} | #{self.class.executeable} --format #{extra_opts} -",
on_error: Proc.new { |output| raise FormatError, output })
end
end
|