class Geary::OptionParser
Public Instance Methods
parse(args)
click to toggle source
# File lib/geary/option_parser.rb, line 8 def parse(args) Configuration.new.tap do |configuration| parser_which_configures(configuration).parse!(Array(args)) end end
parser_which_configures(configuration)
click to toggle source
# File lib/geary/option_parser.rb, line 14 def parser_which_configures(configuration) ::OptionParser.new do |parser| parser.on('-s', '--server SERVERS', Array) do |server_addresses| configuration.server_addresses = server_addresses end parser.on('-r', '--require FILES', Array) do |files| configuration.required_files = files end parser.on('-I', '--include PATHS', Array) do |paths| configuration.included_paths = paths end parser.on('-c', '--concurrency NUMBER', 'number of concurrent tasks to run per server') do |number| configuration.concurrency = Integer(number) end parser.on('-l', '--level LOG_LEVEL', 'log level (FATAL|ERROR|WARN|INFO|DEBUG)') do |level| begin configuration.log_level = Logger.const_get(String(level).upcase) rescue NameError end end end end