Module: Rubeus::JavaPackage

Defined in:
lib/rubeus/component_loader.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(object) ⇒ Object



127
128
129
130
131
132
133
134
135
136
# File 'lib/rubeus/component_loader.rb', line 127

def self.included(object)
  raise "JavaPackage must be extended by a Module" unless object.is_a?(Module)
  object.module_eval do
    attr_accessor :verbose
    alias :method_missing_without_rubeus :method_missing
    alias :method_missing :method_missing_with_rubeus
    alias :const_missing_without_rubeus :const_missing
    alias :const_missing :const_missing_with_rubeus
  end
end

Instance Method Details

#const_missing_with_rubeus(const_name) ⇒ Object



150
151
152
153
154
# File 'lib/rubeus/component_loader.rb', line 150

def const_missing_with_rubeus(const_name)
  result = const_missing_without_rubeus(const_name)
  puts("#{self.name}.const_missing(#{const_name.inspect}) => #{result.inspect}")
  result
end

#method_missing_with_rubeus(method, *args) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
# File 'lib/rubeus/component_loader.rb', line 138

def method_missing_with_rubeus(method, *args)
  java_fqn = "#{@package_name}#{method.to_s}"
  extension = Rubeus::Extensions.apply_for(java_fqn)
  result = method_missing_without_rubeus(method, *args)
  class << result
    include ::Rubeus::JavaPackage
    include Verboseable
  end
  result.verbose = self.verbose
  result
end