Module: Torch::Argv
- Defined in:
- lib/torch/argv.rb
Defined Under Namespace
Classes: Flags
Instance Method Summary collapse
Instance Method Details
#[](flag, *rest) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/torch/argv.rb', line 13 def [](flag, *rest) if rest.empty? and (flag.is_a? String or flag.is_a? Symbol) i = flag_index flag.to_s return nil unless i return nil if self[i+1][0,1] == '-' return self[i+1] else super end end |
#args ⇒ Object
9 10 11 |
# File 'lib/torch/argv.rb', line 9 def args return @args ||= reject{|arg| arg[0,1] == '-'} end |
#flags ⇒ Object
4 5 6 7 |
# File 'lib/torch/argv.rb', line 4 def flags @flags ||= Flags.new(self) return @flags end |