Class: Vnu
- Inherits:
-
Object
- Object
- Vnu
- Defined in:
- lib/vnu.rb
Overview
Ruby wrapper for [vnu](validator.github.io/validator/)
Constant Summary collapse
- JAR_PATH =
File.('../../vnu.jar', __FILE__)
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*options) ⇒ Vnu
constructor
A new instance of Vnu.
- #validate ⇒ Object
- #vnu_cli_with_options(options) ⇒ Object
Constructor Details
#initialize(*options) ⇒ Vnu
Returns a new instance of Vnu.
9 10 11 12 13 14 15 16 17 |
# File 'lib/vnu.rb', line 9 def initialize(*) @target = .shift = .last if target @command = () else fail RuntimeError end end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
7 8 9 |
# File 'lib/vnu.rb', line 7 def command @command end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
7 8 9 |
# File 'lib/vnu.rb', line 7 def target @target end |
Class Method Details
.cli ⇒ Object
28 29 30 |
# File 'lib/vnu.rb', line 28 def cli @cli ||= "java -jar #{JAR_PATH}" end |
.cli_version ⇒ Object
32 33 34 |
# File 'lib/vnu.rb', line 32 def cli_version @cli_version ||= `#{cli} --version`.chomp end |
.validate(*options) ⇒ Object
36 37 38 |
# File 'lib/vnu.rb', line 36 def validate(*) new(*).validate end |
Instance Method Details
#validate ⇒ Object
23 24 25 |
# File 'lib/vnu.rb', line 23 def validate execute(command) end |
#vnu_cli_with_options(options) ⇒ Object
19 20 21 |
# File 'lib/vnu.rb', line 19 def () "#{self.class.cli}#{vnu_options(options)} -" end |