Class: Transpec::OptionParser

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

Constant Summary collapse

CONFIG_ATTRS_FOR_KEEP_TYPES =
{
          should: :convert_should=,
        oneliner: :convert_oneliner=,
  should_receive: :convert_should_receive=,
            stub: :convert_stub=,
      have_items: :convert_have_items=,
             its: :convert_its=,
      deprecated: :convert_deprecated_method=
}
VALID_BOOLEAN_MATCHER_TYPES =
%w(truthy,falsey truthy,falsy true,false)

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.



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

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

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



23
24
25
# File 'lib/transpec/option_parser.rb', line 23

def configuration
  @configuration
end

Class Method Details

.available_conversion_typesObject



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

def self.available_conversion_types
  CONFIG_ATTRS_FOR_KEEP_TYPES.keys
end

Instance Method Details

#helpObject



40
41
42
# File 'lib/transpec/option_parser.rb', line 40

def help
  @parser.help
end

#parse(args) ⇒ Object



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

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