Class: RDocRuboCop::Options
- Inherits:
-
Object
- Object
- RDocRuboCop::Options
- Defined in:
- lib/rdoc_rubocop/options.rb
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
- #option_parser ⇒ Object
- #parse(args) ⇒ Object
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
5 6 7 |
# File 'lib/rdoc_rubocop/options.rb', line 5 def initialize @options = {} end |
Instance Method Details
#option_parser ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rdoc_rubocop/options.rb', line 15 def option_parser OptionParser.new do |opts| opts. = "Usage: rdoc-rubocop [options] [file1, file2, ...]" opts.on("-a", "--auto-correct") { |arg| @options["--auto-correct"] = arg } opts.on("--auto-gen-config") { |arg| @options["--auto-gen-config"] = arg } opts.on("-d", "--debug") { |arg| @options["--debug"] = arg } opts.on("-c", "--config FILE") { |arg| @options["--config"] = arg } opts.on("--only COP1,COP2,...") { |arg| @options["--only"] = arg } opts.on("--except COP1,COP2,...") { |arg| @options["--except"] = arg } end end |
#parse(args) ⇒ Object
9 10 11 12 13 |
# File 'lib/rdoc_rubocop/options.rb', line 9 def parse(args) args = args.dup option_parser.parse!(args) [option_array, args] end |