Hi, I am trying to include all static methods in a Java class so that instead of calling Math.atan(1) I can just call atan(1). To achieve this in Java I would do: import static java.util.Math.*; // or java.util.Math.atan; In JRuby I found out this isn't possible. E.g: include_package 'java.util.Math' # or 'java.util.Math.*' atan(1) # => ERROR: atan not found Math.atan(1) # => OK # Alternative m = Math m.atan(1) # => ok, and best solution so far. It would be greatly appreciated if we could include all/some static methods in a Module to be called without the class name. Cheers, António Alegria
on 2012-07-10 10:47
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.