Sha256: 78266dc50aaee833c258ead726093122e9b735e4b9cc715f83f5595243299dc2
Contents?: true
Size: 1.75 KB
Versions: 33
Compression:
Stored size: 1.75 KB
Contents
--- layout: post title: "pry" keywords: ruby, java, jruby permalink: live/pry.html --- ### 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` ```bash alias jpry="jruby -e \"require 'pry'; binding.pry\"" ``` Then firing up pry with jruby is as simple as ```bash jpry ``` The easiest way to start is to created a template sketch eg `picrate -c fred 200 200` For live editing with vim (there is is an emacs alternative see [pry wiki][prywiki]) You should also create or edit `~/.pryrc` to set the live editor ```bash Pry.config.editor = 'vim' ``` Fire up the pry console then at pry prompt:- ```bash load 'fred_sketch.rb' fred = FredSketch.new edit FredSketch ``` Screen shot on edit from pry  Screen shot on `:wq` from vim  Or if you just wanted to edit the draw loop `edit -p FredSketch#draw` [prywiki]:https://github.com/pry/pry/wiki/Customization-and-configuration But there's much more you can use the pry console for, like regular ruby you can look up methods constants etc:- ```ruby require 'picrate' # => 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 `PiCrate` ```
Version data entries
33 entries across 33 versions & 1 rubygems