Module: Shrug

Defined in:
lib/shrug.rb,
lib/shrug/version.rb

Constant Summary collapse

WHITELIST =
%w(to_ary constantize to_str)
VERSION =
"0.0.3"

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
# File 'lib/shrug.rb', line 7

def method_missing(method, *args, &block)
  return if WHITELIST.include?(method.to_s)

  STDERR.puts("¯\\_(ツ)_/¯ (`#{method.to_s}' undefined)")
  Robustly.report_exception(NoMethodError.new("undefined method `#{method}' for nil:NilClass (¯\\_(ツ)_/¯)"))

  self # magic happens here
end