Class: OptionTest

Inherits:
TestCase
  • Object
show all
Defined in:
lib/slop-2.3.1/test/option_test.rb

Instance Method Summary collapse

Methods inherited from TestCase

test

Instance Method Details

#option(*args, &block) ⇒ Object



4
5
6
# File 'lib/slop-2.3.1/test/option_test.rb', line 4

def option(*args, &block)
  Slop.new.option(*args, &block)
end

#option_value(*args, &block) ⇒ Object



16
17
18
# File 'lib/slop-2.3.1/test/option_test.rb', line 16

def option_value(*args, &block)
  option_with_argument(*args, &block).argument_value
end

#option_with_argument(*args, &block) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/slop-2.3.1/test/option_test.rb', line 8

def option_with_argument(*args, &block)
  options = args.shift
  slop = Slop.new
  option = slop.opt(*args)
  slop.parse(options)
  slop.find {|opt| opt.key == option.key }
end