Module: Superiseable

Overview

Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. License: Apache License, Version 2.0

Instance Method Summary collapse

Instance Method Details

#method_added(method_name) ⇒ Object



10
11
12
13
14
15
# File 'lib/rtm/javatmapi/superiseable.rb', line 10

def method_added(method_name)
  if @superised
    superising method_name
  end
  @superised = false
end

#register_java_implementation(klass) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rtm/javatmapi/superiseable.rb', line 22

def register_java_implementation(klass)
  self.included(klass) if self.respond_to?(:included)
  return unless @superized_methods
  @superized_methods.each do |method_name|
    # klass.class_eval("def #{method_name}(*args); super; end")
    impl = self.instance_method(method_name)
    klass.class_eval do
      define_method method_name, impl
    end
  end
end

#superisedObject



6
7
8
# File 'lib/rtm/javatmapi/superiseable.rb', line 6

def superised
  @superised = true
end

#superising(method_name) ⇒ Object



17
18
19
20
# File 'lib/rtm/javatmapi/superiseable.rb', line 17

def superising method_name
  @superized_methods ||= []
  @superized_methods << method_name
end