Class: RBehave::Runner::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/rbehave/runner/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#debugObject (readonly)

Returns the value of attribute debug.



6
7
8
# File 'lib/rbehave/runner/options.rb', line 6

def debug
  @debug
end

#dry_runObject (readonly)

Returns the value of attribute dry_run.



6
7
8
# File 'lib/rbehave/runner/options.rb', line 6

def dry_run
  @dry_run
end

#formatObject (readonly)

Returns the value of attribute format.



6
7
8
# File 'lib/rbehave/runner/options.rb', line 6

def format
  @format
end

Instance Method Details

#parse(args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rbehave/runner/options.rb', line 8

def parse(args)
  parser = OptionParser.new do |p|
    p.banner = "Usage: ruby your_stories.rb [options]"
    p.separator ""
    p.separator "Options:"
    p.on "-n", "--dry-run", "dry run - no execution" do
      @dry_run = true
    end
    formats = [:simple, :rdoc, :html, :xml]
    p.on "-f", "--format ", formats, "format (#{formats.join(',')})" do |fmt|
      @format = fmt.to_sym
    end
    p.on '--debug' do
      @debug = true
    end
  end
  parser.parse(args)
  self
end