module AutoCamelize

Public Instance Methods

ds_equivalent(string) click to toggle source

Find the equivalent built-in method name, if there is one. Example: ds_equivalent(‘pdf_bytes’) => ‘pDFBytes’

# File lib/docu_sign/extensions.rb, line 59
def ds_equivalent(string)
  string = string.to_s.camelize(:lower)
  methods.find { |m| m.downcase == string.downcase }
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/docu_sign/extensions.rb, line 39
def method_missing(method_name, *args, &block)
  ds_name = ds_equivalent(method_name)

  if ds_name && respond_to?(ds_name)
    self.class.class_eval %Q{
      def #{method_name}(*args, &block)
        send "#{ds_name}", *args, &block
      end
    }

    send method_name, *args, &block
  else
    super
  end
end