Module: AutoCamelize
- Defined in:
- lib/docusign/extensions.rb
Instance Method Summary collapse
-
#ds_equivalent(string) ⇒ Object
Find the equivalent built-in method name, if there is one.
- #method_missing(method_name, *args, &block) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/docusign/extensions.rb', line 29 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 |
Instance Method Details
#ds_equivalent(string) ⇒ Object
Find the equivalent built-in method name, if there is one. Example: ds_equivalent(‘pdf_bytes’) => ‘pDFBytes’
49 50 51 52 |
# File 'lib/docusign/extensions.rb', line 49 def ds_equivalent(string) string = string.to_s.camelize(:lower) methods.find { |m| m.downcase == string.downcase } end |