Module: Options
- Defined in:
- lib/options.rb
Class Method Summary collapse
Class Method Details
.parse! ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/options.rb', line 4 def self.parse! = OpenStruct.new host: "localhost", port: 3000, start_at: 0 OptionParser.new do |opts| opts.on("-h", "--host_name=val", String) { |arg| .host = arg } opts.on("-p", "--port=val", Integer) { |arg| .port = arg } opts.on("-s", "--start_at=", Integer) { |arg| .start_at = arg } opts.on("", "--help") { exec "more #{__FILE__}" } end.parse! end |