Class: Transpec::OptionParser

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

Overview

rubocop:disable ClassLength

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=,
         pending: :convert_pending=,
      deprecated: :convert_deprecated_method=
}
CONFIG_ATTRS_FOR_CONVERT_TYPES =
{
   example_group: :convert_example_group=,
      hook_scope: :convert_hook_scope=,
  stub_with_hash: :convert_stub_with_hash_to_allow_to_receive_and_return=
}
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(config = Config.new) ⇒ OptionParser

Returns a new instance of OptionParser.



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

def initialize(config = Config.new)
  @config = config
  setup_parser
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

Class Method Details

.available_conversion_typesObject



33
34
35
# File 'lib/transpec/option_parser.rb', line 33

def self.available_conversion_types
  CONFIG_ATTRS_FOR_KEEP_TYPES.keys
end

Instance Method Details

#helpObject



48
49
50
# File 'lib/transpec/option_parser.rb', line 48

def help
  @parser.help
end

#parse(args) ⇒ Object



42
43
44
45
46
# File 'lib/transpec/option_parser.rb', line 42

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