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

- (Object) method_missing(meth, *args, &blk) (private)

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



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

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