Module: Autocorrect::Whiny

Includes:
Common
Defined in:
lib/autocorrect/whiny.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/autocorrect/whiny.rb', line 7

def method_missing(method, *args, &block)
  # Cargo-culted from whiny_nil.rb
  if method == :to_ary || method == :to_str
    super
  elsif guessed_method = guess_callable_method_for(method, args.length)
    raise_method_missing_warning_for guessed_method, method, args, caller
  elsif guessed_method = guess_closest_matched_name_method_for(method)
    raise_method_missing_with_mismatched_args_warning_for guessed_method, method, args, caller
  else
    super
  end
end