Sha256: 8a140461fe838620379304856fd144fd923419259f69d01d388e5438bd338e03
Contents?: true
Size: 855 Bytes
Versions: 6
Compression:
Stored size: 855 Bytes
Contents
# this is a little meta magic to clean up some of the repetition in the client # i noticed that i kept making the same similiar methods for each event such as # # client_events :object_creation # # which causes these two methods to be created # def on_object_creation( &object_creation_blk ) # @object_creation_callback_blk = object_creation_blk # end # # def trigger_object_creation_callback( tuio ) # @object_creation_callback_blk.call( tuio ) if @object_creation_callback_blk # end class Object def client_events( *args ) args.each do | event | self.class_eval <<-EOF def on_#{event}( &#{event}_blk ) @#{event}_callback_blk = #{event}_blk end def trigger_#{event}_callback( tuio ) @#{event}_callback_blk.call( tuio ) if @#{event}_callback_blk end EOF end end end
Version data entries
6 entries across 6 versions & 2 rubygems