Class: PVN::App::Base::CmdLineArgs
- Inherits:
-
Object
- Object
- PVN::App::Base::CmdLineArgs
- Includes:
- Logue::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.
29 30 31 32 33 |
# File 'lib/pvn/command/clargs.rb', line 29 def initialize optset, args @optset = optset process args @unprocessed = args end |
Instance Attribute Details
#unprocessed ⇒ Object (readonly)
Returns the value of attribute unprocessed.
27 28 29 |
# File 'lib/pvn/command/clargs.rb', line 27 def unprocessed @unprocessed end |
Class Method Details
.has_option(name) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pvn/command/clargs.rb', line 13 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
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pvn/command/clargs.rb', line 35 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 |