module JavaHead

The namespace for the classes

Constants

CLASSPATH

An array of Pathnames representing the CLASSPATH environment variable Defaults to the current values of the $CLASSPATH environment variable

VERSION

Public Class Methods

>(name)

> is an alias for member

Alias for: member
class(name = nil) click to toggle source

Returns the class with no arguments Returns a new class with the given name if an argument is passed

@param [String] name the name of the class to initialize @return [JavaHead::Class] the resulting class

Calls superclass method
# File lib/java_head.rb, line 27
def class(name = nil)
  return super() if name.eql? nil
  JavaHead::Class.new(name)
end
const_missing(const_name) click to toggle source

Try to load the file const_name if the constant cannot be found

@param [String] const_name @return [Regexp,Array,Class] the value of the constant const_name in the namespace of JavaHead

Calls superclass method
# File lib/java_head.rb, line 52
def const_missing(const_name)
  require "#{__dir__}/java_head/#{const_name.to_s.downcase}.rb"
  return const_get const_name
rescue LoadError
  super
end
member(name) click to toggle source

Creates either a class or a package depending on the format of the given string

@param [String] name the name of the child element @return [JavaHead::Package, JavaHead::Class] the resulting package or class object

# File lib/java_head.rb, line 37
def member(name)
  if name.match JavaHead::Class::FORMAT
    self.class(name)
  else
    package(name)
  end
end
Also aliased as: >
package(name) click to toggle source

Find a package using Package.get

@param [String] name the name of the package to be found @return [JavaHead::Package] the package corresponding to name

# File lib/java_head.rb, line 18
def package(name)
  JavaHead::Package.get(name)
end