Method: AppKernel::Function::ClassMethods#prepare!
- Defined in:
- lib/appkernel/function.rb
#prepare! ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/appkernel/function.rb', line 74 def prepare! = Options.new call = Module.new.tap do |mod| unless self.name.nil? || self.name.empty? fun = self path = self.name.split(/::/) simple_name = path[path.length - 1] fun_name = simple_name.gsub(/(\w)([A-Z])([a-z])/) {"#{$1}_#{$2.downcase}#{$3}"}.downcase mod.send(:define_method, fun_name) do |*args| fun.call(*args) end end end self.const_set(:Call, call) end |