Sha256: 5c847cd6ca599b8312b147965007daea69976a39007e7c42297bab08881c07b5

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

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

module Superiseable

  def superised
    @superised = true
  end
  
  def method_added(method_name)
    if @superised
      superising method_name
    end
    @superised = false
  end
  
  def superising method_name
    @superized_methods ||= []
    @superized_methods << method_name
  end
  
  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-javatmapi-0.3.1-java lib/rtm/javatmapi/superiseable.rb