13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/delorean/ruby/whitelists/base.rb', line 13
def add_method(method_name, match_to: nil, &block)
return method_name_error unless method_name.is_a?(Symbol)
return block_and_match_error if !match_to.nil? && block_given?
unless match_to.nil?
return add_matched_method(
method_name: method_name, match_to: match_to
)
end
matcher = matchers[method_name.to_sym]
return matcher.extend_matcher(&block) if matcher
matchers[method_name.to_sym] = method_matcher_class.new(
method_name: method_name, &block
)
end
|