class CucumberOffRails::Generator::Options

Attributes

opts[R]
orig_args[R]

Public Class Methods

new(args) click to toggle source
Calls superclass method
# File lib/cucumber_off_rails/generator/options.rb, line 6
def initialize(args)
  super()
  @orig_args = args.clone

  require 'optparse'
  @opts = OptionParser.new do |o|
    o.banner = "Usage: #{File.basename($0)} [options]\ne.g. #{File.basename($0)} --set http://www.google.com"

    # need to add a directory option

    o.on('--site [SITE]', 'specify the site to remotely access through capybara' do |site|
      self[:site] = site
    end

  end

  begin
    @opts.parse!(args)
  rescue OptionParser::InvalidOption => e
    self[:invalid_argument] = e.message
  end
end

Public Instance Methods

merge(other) click to toggle source

what this for?

# File lib/cucumber_off_rails/generator/options.rb, line 30
def merge(other)
  self.class.new(@orig_args + other.orig_args)
end