In Files
Parent
Information
Class Index
![show/hide quicksearch [+]](./assets/icon/find.png)
- Ratch
- Ratch::Batch
- Ratch::CLI
- Ratch::ConfigUtils
- Ratch::Console
- Ratch::EmailUtils
- Ratch::Emailer
- Ratch::FTPUtils
- Ratch::FileList
- Ratch::FileNotFound
- Ratch::Help
- Ratch::POMUtils
- Ratch::RDocUtils
- Ratch::Script
- Ratch::Shell
- Ratch::System
- Ratch::TarUtils
- Ratch::XDGUtils
- Ratch::ZlibUtils
- FileTest
- Hash
- NilClass
- Object
- String
Hash
Public Instance Methods
argumentize(args_field=nil)
click to toggle source
Turn a hash into arguments.
h = { :list => [1,2], :base => "HI" }
h.argumentize #=> [ [], { :list => [1,2], :base => "HI" } ]
h.argumentize(:list) #=> [ [1,2], { :base => "HI" } ]
# File lib/ratch/core_ext/to_console.rb, line 83
83: def argumentize(args_field=nil)
84: config = dup
85: if args_field
86: args = [config.delete(args_field)].flatten.compact
87: else
88: args = []
89: end
90: args << config
91: return args
92: end
Also aliased as: command_vector
to_argv()
click to toggle source
Convert a Hash into command line parameters. The array is accepted in the format of Ruby method arguments —ie. [arg1, arg2, …, hash]
# File lib/ratch/core_ext/to_console.rb, line 59
59: def to_argv
60: flags = []
61: each do |f,v|
62: m = f.to_s.size == 1 ? '-' : '--'
63: case v
64: when Array
65: v.each{ |e| flags << "#{m}#{f}='#{e}'" }
66: when true
67: flags << "#{m}#{f}"
68: when false, nil
69: # nothing
70: else
71: flags << "#{m}#{f}='#{v}'"
72: end
73: end
74: flags
75: end
to_console()
click to toggle source
Convert a Hash into command line arguments. The array is accepted in the format of Ruby method arguments —ie. [arg1, arg2, …, hash]
# File lib/ratch/core_ext/to_console.rb, line 52
52: def to_console
53: to_argv.join(' ')
54: end
Disabled; run with --debug to generate this.