C-c
+
M-j
: Jack into an nREPL session and open a REPL buffer.M-n
: Switch REPL to the current buffer's namespace.C-z
: Open REPL and move cursor to REPL.C-o
: Clear the last line's output.M-o
: Clear all the output
Resetting... | |
Resetting stock for product 22 to 104 units. | |
(1 row(s) affected) | |
Removing order (OrderID=11077, ProductID=22). | |
(1 row(s) affected) | |
Adding order to Order Details table for 50 units of product 22. | |
(1 row(s) affected) |
ruby_version = ask("What ruby version is your app?") | |
ruby_gemset = ask("What do you want to name your gemset?") | |
file(".ruby-version", ruby_version) | |
file(".ruby-gemset", ruby_gemset) | |
gem 'haml-rails' | |
gem 'bootstrap-sass' |
module Foo | |
def self.included base | |
puts "Included by #{base}" | |
end | |
end | |
class Bar | |
include Foo | |
def self.inherited(base) |
require 'rspec' | |
require 'date' | |
describe "Tim's Methods:" do | |
let(:tim) { TimAffinity.new } | |
context "Tim is in India and" do | |
it "should be clear that Tim needs to get his ass back here" do | |
tim.do_we_want_him_back?.should be_true |
# Foo is a constant that | |
Foo = Class.new | |
# We can define a superclass as an argument of the Class#new method, | |
# but the default is Object, and we are fine with that. | |
#=> Foo | |
Foo.class_eval do | |
def bar | |
:baz | |
end |
class Example | |
def foo | |
def foo | |
:every_other_call | |
end | |
:first_call | |
end | |
end |
require 'reuse' | |
class User | |
include ReUser | |
roles do | |
role(:admin) {|r| r.actions(:read, :write, :execute)} | |
role(:user) {|r| r.action(:read)} | |
default :user | |
end |
class User | |
include ReUser | |
roles do | |
role :god do |r| | |
r.action :manage_all | |
r.aciton :new_user_session | |
r.action :create_user_session | |
r.action :destroy_user_session | |
end |
roles do | |
role :admin, [:read, :write, :execute] | |
role :user do |r| | |
action :read | |
end | |
end |