class Options
Attributes
argv[R]
options[R]
Public Class Methods
new( argv, options={})
click to toggle source
# File lib/freshmind.rb, line 22 def initialize( argv, options={}) @argv = argv @options = options end
Public Instance Methods
args()
click to toggle source
# File lib/freshmind.rb, line 27 def args res = {} options.each do |opt_key, opt_value| opt_value[:variants].each do |variant| arg_index = argv.index(variant.to_s) res[opt_key] = arg_index.nil? ? opt_value[:default] : argv[arg_index].to_sym end end res end