Module: Java
- Defined in:
- lib/jinx/import/java.rb
Defined Under Namespace
Modules: JavaUtil
Constant Summary collapse
- NAME_SPLITTER_REGEX =
/^([\w.]+)\.(\w+)$/
Class Method Summary collapse
- .expand_to_class_path(path) ⇒ Object
-
.load_properties(name) ⇒ Hash?
The properties content, or nil if the file is not on the classpath.
- .now ⇒ Object
-
.split_class_name(name_or_class) ⇒ String
The package and base for the given name.
Class Method Details
.expand_to_class_path(path) ⇒ Object
14 15 16 |
# File 'lib/jinx/import/java.rb', line 14 def self.(path) @cp_mod.(path) end |
.load_properties(name) ⇒ Hash?
Returns the properties content, or nil if the file is not on the classpath.
20 21 22 23 24 25 |
# File 'lib/jinx/import/java.rb', line 20 def self.load_properties(name) url = JRuby.runtime.jruby_class_loader.findResource(name) || return props = JavaUtil::Properties.new props.load(url.openStream) props end |
.now ⇒ Object
187 188 189 |
# File 'lib/jinx/import/java.rb', line 187 def self.now JavaUtil::Date.from_ruby_date(DateTime.now) end |
.split_class_name(name_or_class) ⇒ String
Returns the package and base for the given name.
193 194 195 196 197 |
# File 'lib/jinx/import/java.rb', line 193 def self.split_class_name(name_or_class) name = Class === name_or_class ? name_or_class.java_class.name : name_or_class match = NAME_SPLITTER_REGEX.match(name) match ? match.captures : [nil, name] end |