Sha256: 0cad13f4370c1403c4103c641d35bdec2628a8bcaba04051d16d06743dfcf78e

Contents?: true

Size: 694 Bytes

Versions: 1

Compression:

Stored size: 694 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 do
        define_method(method_name) { |*args| super *args}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-javatmapi-0.2.1 lib/rtm/javatmapi/superiseable.rb