Permalink
Browse files

add ability to call arbitrary methods on ruby classes

  • Loading branch information...
1 parent 9887283 commit e3920d8de7bd32c038119c4c62d3f68204519930 @defunkt committed Jun 24, 2009
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/lyndon/ruby.rb
View
@@ -1,12 +1,17 @@
module Lyndon
class Ruby
- def puts(*args)
- super
- end
-
+ ##
+ # Lets us call simple ruby methods
+ #
+ # Ruby.IO_read(file)
+ # Ruby.puts('hi')
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])_(\w+)/
+ Kernel.const_get($1).send($2, *args)
end
end
end

0 comments on commit e3920d8

Please sign in to comment.