Sha256: 204eee652c6450a87faacce79747308524b546dc68414dcdf5531aa29764f8ce

Contents?: true

Size: 602 Bytes

Versions: 3

Compression:

Stored size: 602 Bytes

Contents

module Rubeus::Extensions::Javax::Swing
  module Timer
    def self.included(base)
      base.extend ClassMethods
      base.instance_eval do
        alias :new_without_rubeus :new
        alias :new :new_with_rubeus
      end
    end
 
    module ClassMethods
      def new_with_rubeus(interval, &block)
        # Create ActionListener implement class
        mod = Module.new do
          define_method("actionPerformed", &block)
        end
 
        obj = Object.new
        obj.extend(mod)
 
        # Use original constructor
        new_without_rubeus(interval, obj)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubeus-0.0.8-java lib/rubeus/extensions/javax/swing/timer.rb
rubeus-0.0.6-java lib/rubeus/extensions/javax/swing/timer.rb
rubeus-0.0.7-java lib/rubeus/extensions/javax/swing/timer.rb