The Art of Rails Cooking with IRuby Notebook

August 12, 2014

Alex Yankov

@aleksyankov

Handybook.com

Agenda

  • Discuss IRuby
  • Demo IRuby
  • Demo IRuby + Rails
  • Questions?

What is IPython?

IPython is a project to improve python's REPL. Headed by Fernando Perez

Brief History

  • Started in 2001
  • Backend & Frontend seperated in 2009
  • Notebook 2011

What is IPython notebook?

The Notebook is an html interface to the ipython kernel over zeromq.

What is the IRuby notebook?

IPython's notebook html interface and controller with a ruby kernel running pry or irb. Currently maintained by Daniel Mendler


In [1]:
File.open( '/Users/alexyankov/Downloads/julia-child.jpg' )


Out[1]:

In [2]:
#IRuby.html "<style>.navbar-inner, #menubar-container {display: none}</style>"

In [3]:
require ::File.expand_path('../lib/irails',  __FILE__)


Out[3]:
true

In [4]:
IRails.render "welcome/about"


Out[4]:
"<p>French Cooking Blog.</p>"

In [5]:
IRuby.html IRails.render "articles/index", locals: {:@articles => Article.all}


Out[5]:

Listing articles

New article
Title Text
Mastering the Art of French Cooking Mastering the Art of French Cooking… doesn't mean it has to be fancy cooking, although it can be as elaborate as you wish. — Julia Child Show Edit
Julia on Dieting The only time to eat diet food is while you're waiting for the steak to cook. - Indirect quote on The National (CBC TV), Show Edit

Setup Instructions

Install iruby from https://github.com/minad/iruby

Install irails from https://github.com/handybook/irails