Live coding with jirb

Fire up the jirb console then at irb prompt:-

"load 'fred_sketch.rb'"

irb

Live coding with pry and vim

First you will need to jgem install pry

Easy use configuration in your ~/.bashrc (many linux distros) or ~/.profile (MacOS, ubuntu, mint) etc include

alias jpry="jruby -e \"require 'pry'; binding.pry\""

Then firing up pry with jruby is as simple as

jpry

For live editing with vim (there is is an emacs alternative see pry wiki)

You should also create or edit ~/.pryrc to set the live editor

Pry.config.editor = 'vim'

Fire up the pry console then at pry prompt:-

"load 'fred_sketch.rb'"
fred = FredSketch.new
edit FredSketch

Screen shot on edit from pry

pry

Screen shot on :wq from vim

pry

Or if you just wanted to edit the draw loop

edit -p FredSketch#draw

But there’s much more you can use the pry console for, like regular ruby you can look up methods constants etc:-

require 'propane'
# => true
Java::ProcessingCore::PConstants.constants
# => [:PATH,
# :DISABLE_TEXTURE_MIPMAPS,
# :POLYGON,
# :POSTERIZE,
# :ENABLE_DEPTH_TEST,
# :TEXT,
# :BOTTOM,
# :CLOSE,
# :MIN_INT,
# ...]
Java::ProcessingCore::PConstants::P3D
# => "processing.opengl.PGraphics3D"
Java::ProcessingCore::PApplet.methods
# [:create_reader,
# :year,
# :java_method,
# :degrees,
# :blend_color,
# :show_variation_warning,
# :runSketch,
# :lerpColor,
# :shorten,
# :trim,
# :sqrt,
# :calcSketchPath,
# ...]
# Note snake case methods, also not all the methods will be useful in `propane`