Module: Tree::Utils::CamelCaseMethodHandler

Included in:
TreeNode
Defined in:
lib/tree/utils/camel_case_method_handler.rb

Overview

Provides utility functions to handle CamelCase methods, and redirect invocation of such methods to the snake_case equivalents.

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object (private)

Allow the deprecated CamelCase method names. Display a warning. :nodoc:



50
51
52
53
54
55
56
57
58
59
# File 'lib/tree/utils/camel_case_method_handler.rb', line 50

def method_missing(meth, *args, &blk)
  if self.respond_to?((new_method_name = to_snake_case(meth)))
    warn StructuredWarnings::DeprecatedMethodWarning,
         'The camelCased methods are deprecated. ' +
         "Please use #{new_method_name} instead of #{meth}"
    send(new_method_name, *args, &blk)
  else
    super
  end
end