Class: Inch::CLI::Command::Options::Base
- Inherits:
-
Object
- Object
- Inch::CLI::Command::Options::Base
- Includes:
- TraceHelper, YardoptsHelper
- Defined in:
- lib/inch/cli/command/options/base.rb
Overview
Abstract base class for CLI options. Provides some helper methods for the option parser
Direct Known Subclasses
Constant Summary
Constants included from YardoptsHelper
YardoptsHelper::VALID_YARD_SWITCHES
Instance Attribute Summary
Attributes included from YardoptsHelper
Class Method Summary collapse
Instance Method Summary collapse
- #parse(args) ⇒ Object
- #set_options(opts) ⇒ Object
-
#verify ⇒ Object
Override and fill with validations.
Methods included from YardoptsHelper
#parse_yardopts_options, #yardopts_options
Methods included from TraceHelper
Class Method Details
.attribute(name, default = nil) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/inch/cli/command/options/base.rb', line 15 def attribute(name, default = nil) define_method(name) do instance_variable_get("@#{name}") || default end define_method("#{name}=") do |value| instance_variable_set("@#{name}", value) end end |
Instance Method Details
#parse(args) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/inch/cli/command/options/base.rb', line 29 def parse(args) opts = OptionParser.new opts. = usage descriptions.each do |text| opts.separator " " + text end (opts) (opts, args) end |
#set_options(opts) ⇒ Object
41 42 43 |
# File 'lib/inch/cli/command/options/base.rb', line 41 def (opts) (opts) end |
#verify ⇒ Object
Override and fill with validations
46 47 |
# File 'lib/inch/cli/command/options/base.rb', line 46 def verify end |