Sha256: 9b0c360e42bcf5eec6144b4244fd423916b72a9c72b3c3a6523dc2aa505c4165

Contents?: true

Size: 452 Bytes

Versions: 8

Compression:

Stored size: 452 Bytes

Contents

module Wx
	class EvtHandler
		def register_for_message(message, method = nil, &block)
			raise "Must pass method or block" unless block || method

			block ||= Proc.new {|*args| self.send(method, *args)}
			@@message_blocks ||= {}
			@@message_blocks[message] ||= []
			@@message_blocks[message] << block
		end

		def send_message(message, *args)
			blocks = @@message_blocks[message] || []
			blocks.each {|block| block.call(*args)}
		end

	end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tekkub-fugit-0.0.0 lib/fugit/messages.rb
tekkub-fugit-0.0.1 lib/fugit/messages.rb
tekkub-fugit-0.0.2 lib/fugit/messages.rb
tekkub-fugit-0.0.3 lib/fugit/messages.rb
tekkub-fugit-0.0.4 lib/fugit/messages.rb
tekkub-fugit-0.0.5 lib/fugit/messages.rb
tekkub-fugit-0.0.6 lib/fugit/messages.rb
tekkub-fugit-0.0.7 lib/fugit/messages.rb