class Rspec::Bash::Util::CallConfArgumentListMatcher

Public Class Methods

new(call_conf_list) click to toggle source
# File lib/rspec/bash/util/call_conf_argument_list_matcher.rb, line 12
def initialize(call_conf_list)
  @expected_call_conf_list = call_conf_list
end
Also aliased as: parent_initialize

Public Instance Methods

args_match?(call_arguments) click to toggle source
# File lib/rspec/bash/util/call_conf_argument_list_matcher.rb, line 16
def args_match?(call_arguments)
  !get_call_conf_matches(call_arguments).empty?
end
Also aliased as: parent_args_match?
get_best_call_conf(call_arguments) click to toggle source
# File lib/rspec/bash/util/call_conf_argument_list_matcher.rb, line 20
def get_best_call_conf(call_arguments)
  get_call_conf_matches(call_arguments).sort_by do |call_conf|
    [
      call_conf[:args].length
    ]
  end.last || {}
end
get_call_conf_matches(call_arguments) click to toggle source
# File lib/rspec/bash/util/call_conf_argument_list_matcher.rb, line 28
def get_call_conf_matches(call_arguments)
  @expected_call_conf_list.select do |expected_call_conf|
    @expected_args = remap_argument_matchers(expected_call_conf[:args])
    parent_args_match?(*call_arguments)
  end
end
parent_args_match?(call_arguments)
Alias for: args_match?
parent_initialize(call_conf_list)
Alias for: new

Private Instance Methods

remap_argument_matchers(expected_call_conf_args) click to toggle source
# File lib/rspec/bash/util/call_conf_argument_list_matcher.rb, line 37
def remap_argument_matchers(expected_call_conf_args)
  expected_call_conf_args.map! do |expected_arg|
    next expected_arg unless expected_arg.is_a?(ArgumentMatchers::SingletonMatcher)
    Object.const_get("#{expected_arg.class}::INSTANCE")
  end
  expected_call_conf_args.empty? ? [any_args] : expected_call_conf_args
end