Class: Transpec::OptionParser

Inherits:
Object
  • Object
show all
Defined in:
lib/transpec/option_parser.rb

Constant Summary collapse

CONFIG_ATTRS_FOR_CLI_TYPES =
{
          should: :convert_should=,
  should_receive: :convert_should_receive=,
            stub: :convert_stub=,
      have_items: :convert_have_items=,
      deprecated: :convert_deprecated_method=
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration = Configuration.new) ⇒ OptionParser

Returns a new instance of OptionParser.



25
26
27
28
# File 'lib/transpec/option_parser.rb', line 25

def initialize(configuration = Configuration.new)
  @configuration = configuration
  setup_parser
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



19
20
21
# File 'lib/transpec/option_parser.rb', line 19

def configuration
  @configuration
end

Class Method Details

.available_conversion_typesObject



21
22
23
# File 'lib/transpec/option_parser.rb', line 21

def self.available_conversion_types
  CONFIG_ATTRS_FOR_CLI_TYPES.keys
end

Instance Method Details

#helpObject



36
37
38
# File 'lib/transpec/option_parser.rb', line 36

def help
  @parser.help
end

#parse(args) ⇒ Object



30
31
32
33
34
# File 'lib/transpec/option_parser.rb', line 30

def parse(args)
  args = args.dup
  @parser.parse!(args)
  args
end