Sha256: 7c20be44c083a2475424a408e571ebffd2b326e67f24a2f303c5c6ad501e8b36

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 Bytes

Contents

require 'rubysketch'


begin
  context = RubySketch::Processing.new
  methods = context.class.instance_methods(false)
    .reject {|name| name =~ /__$/}
  consts  = context.class.constants
    .reject {|name| name =~ /__$/}
    .each_with_object({}) {|name, h| h[name] = context.class.const_get name}

  self.class.class_eval do
    methods.each do |name|
      define_method name do |*args, &block|
        context.__send__ name, *args, &block
      end
    end
    consts.each do |(name, value)|
      const_set name, value
    end
  end

  window = RubySketch::Window.new do |_|
    window.start
  end
  context.setup__ window

  window.canvas_painter.__send__ :begin_paint
  at_exit do
    window.canvas_painter.__send__ :end_paint
    Reflex.start {window.show}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysketch-0.2.7 lib/rubysketch-processing.rb
rubysketch-0.2.6 lib/rubysketch-processing.rb