Class: Rspec::Bash::Util::CallConfArgumentListMatcher
- Inherits:
-
ArgumentListMatcher
- Object
- ArgumentListMatcher
- Rspec::Bash::Util::CallConfArgumentListMatcher
- Defined in:
- lib/rspec/bash/util/call_conf_argument_list_matcher.rb
Instance Method Summary collapse
- #args_match?(call_arguments) ⇒ Boolean
- #get_best_call_conf(call_arguments) ⇒ Object
- #get_call_conf_matches(call_arguments) ⇒ Object
-
#initialize(call_conf_list) ⇒ CallConfArgumentListMatcher
constructor
A new instance of CallConfArgumentListMatcher.
- #parent_args_match? ⇒ Object
- #parent_initialize ⇒ Object
Constructor Details
#initialize(call_conf_list) ⇒ CallConfArgumentListMatcher
Returns a new instance of CallConfArgumentListMatcher.
12 13 14 |
# 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 |
Instance Method Details
#args_match?(call_arguments) ⇒ Boolean
16 17 18 |
# 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 |
#get_best_call_conf(call_arguments) ⇒ Object
20 21 22 23 24 25 26 |
# 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) ⇒ Object
28 29 30 31 32 33 |
# 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? ⇒ Object
9 |
# File 'lib/rspec/bash/util/call_conf_argument_list_matcher.rb', line 9 alias parent_args_match? args_match? |
#parent_initialize ⇒ Object
10 |
# File 'lib/rspec/bash/util/call_conf_argument_list_matcher.rb', line 10 alias parent_initialize initialize |