Class: Lyndon::Ruby
- Inherits:
-
Object
- Object
- Lyndon::Ruby
- Defined in:
- lib/lyndon/ruby.rb
Instance Method Summary collapse
-
#invokeDefaultMethodWithArguments(args) ⇒ Object
Ruby(‘$LOAD_PATH’) => array…
-
#invokeUndefinedMethodFromWebScript(name, withArguments: args) ⇒ Object
Lets us call simple ruby methods.
Instance Method Details
#invokeDefaultMethodWithArguments(args) ⇒ Object
Ruby(‘$LOAD_PATH’) => array… Ruby(‘1 + 1’) => 2
31 32 33 |
# File 'lib/lyndon/ruby.rb', line 31 def invokeDefaultMethodWithArguments(args) eval(args[0]) end |
#invokeUndefinedMethodFromWebScript(name, withArguments: args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lyndon/ruby.rb', line 9 def invokeUndefinedMethodFromWebScript(name, withArguments:args) if respond_to? name send(name, *args) elsif Kernel.respond_to? name Kernel.send(name, *args) elsif name =~ /^([A-Z][A-Za-z]+)_(.+)/ const = Kernel.const_get($1) method = $2 if const.respond_to? method const.send(method, *args) elsif const.respond_to?("#{method}?") const.send("#{method}?", *args) elsif const.respond_to?("#{method}!") const.send("#{method}!", *args) end end end |