Class: PVN::App::Base::CmdLineArgs
- Inherits:
-
Object
- Object
- PVN::App::Base::CmdLineArgs
- Includes:
- Loggable
- Defined in:
- lib/pvn/command/clargs.rb
Instance Attribute Summary collapse
-
#unprocessed ⇒ Object
readonly
Returns the value of attribute unprocessed.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(optset, args) ⇒ CmdLineArgs
constructor
A new instance of CmdLineArgs.
- #process(args) ⇒ Object
Constructor Details
#initialize(optset, args) ⇒ CmdLineArgs
Returns a new instance of CmdLineArgs.
27 28 29 30 31 |
# File 'lib/pvn/command/clargs.rb', line 27 def initialize optset, args @optset = optset process args @unprocessed = args end |
Instance Attribute Details
#unprocessed ⇒ Object (readonly)
Returns the value of attribute unprocessed.
25 26 27 |
# File 'lib/pvn/command/clargs.rb', line 25 def unprocessed @unprocessed end |
Class Method Details
.has_option(name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pvn/command/clargs.rb', line 11 def has_option name define_method name do info "name: #{name}" self.instance_eval do meth = name info "meth: #{meth}" val = @optset.send name info "val: #{val}" val end end end |
Instance Method Details
#process(args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/pvn/command/clargs.rb', line 33 def process args = Array.new while !args.empty? processed = false @optset..each do |opt| if opt.process args processed = true << opt end end break unless processed end .each do |opt| opt.post_process @optset, args end end |