Ruby news and discussion, interviews
- URL: http://rubyrogues.com
- Schedule: Weekly
- Duration: 80 minutes
def test_proc | |
Proc.new { return }.call | |
puts 'Never see this...' | |
end | |
def test_lambda | |
lambda { return }.call | |
puts 'Do see this...' |
require 'relations' | |
class Employee | |
extend Relations | |
belongs_to :manager | |
end | |
Ruby news and discussion, interviews
def sleep_sort(*nums) | |
sorted = [] | |
nums.map do |n| | |
Thread.new { sleep n; sorted << n } | |
end.map(&:join) | |
sorted | |
end |
Note: Remove example deps from the local mvn cache so they need to be installed for the demo
$ rm -r ~/.m2/repository/{com/steelcity, jruby}
First, create your amazing Ruby library that you'd like to use in Clojure. We must require 'java'
and we must specify a java package because the default package cannot be imported into our Clojure project.
describe 'rspec' do | |
let(:sentance) { 'hello' } | |
it "returns 'hello'" do | |
sentance.should == 'hello' | |
end |
Running 100000 iterations... | |
each: 6.872149 | |
inject: 6.868875 | |
map: 0.093785 |
git for-each-ref --format='%(refname:short) <- %(upstream:short)' refs/heads |
class Array | |
def [](index) | |
fetch(index) | |
end | |
end |