Class: JSLintV8::OptionParser
- Inherits:
-
OptionParser
- Object
- OptionParser
- JSLintV8::OptionParser
- Defined in:
- lib/jslint-v8/option_parser.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ OptionParser
constructor
A new instance of OptionParser.
Constructor Details
#initialize ⇒ OptionParser
Returns a new instance of OptionParser.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jslint-v8/option_parser.rb', line 8 def initialize super @options = {} @options[:lint_options] = {} self.version = JSLintV8::Version::STRING self. = "#{self.} <filepattern>..." Runner::DefaultOptions.keys.each do |option| default = Runner::DefaultOptions[option] ? "on" : "off" long = "--[no-]#{option}" desc = "#{Runner::OptionDescriptions[option]} (default=#{default})" on(long, desc) do |value| [:lint_options][option] = value end end on("--json", "Return output in JSON format") do |j| [:json] = j end on("-h", "--help", "Show this message") do STDERR.puts self.help exit(-1) end on("-v", "--version", "Show version") do STDERR.puts "#{self.program_name} version #{JSLintV8::Version::STRING}" exit(-1) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/jslint-v8/option_parser.rb', line 6 def @options end |