Sha256: 3bcb696a3c7687e25ba4b3eae3f0069aadd1c793b82e2e2fac76a79866174267

Contents?: true

Size: 720 Bytes

Versions: 3

Compression:

Stored size: 720 Bytes

Contents

require "rubyfox/client/java"

module Rubyfox
  module Client
    Event = Java::SFSEvent

    class Event
      self.__persistent__ = true

      def self.types(&block)
        constants
      end

      def self.[](name)
        const_get(name.to_s.upcase)
      end

      def params
        @params ||= EventParams.new(arguments)
      end

      def inspect
        "#{super}: #{type}(#{arguments.inspect})"
      end
    end

    class EventParams
      include Enumerable

      def initialize(hash)
        @hash = hash
      end

      def [](key)
        @hash[key.to_s]
      end

      def each(&block)
        @hash.each(&block)
      end

      def inspect
        @hash.inspect
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubyfox-client-0.6.0-java lib/rubyfox/client/event.rb
rubyfox-client-0.5.0-java lib/rubyfox/client/event.rb
rubyfox-client-0.4.0-java lib/rubyfox/client/event.rb