This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR: While executing gem ... (Gem::FilePermissionError) | |
You don't have write permissions into the /Users/andrewwagner/.rvm/gems/rbx-head-head-master directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvm rubies | |
jruby-1.6.4 [ darwin-x86_64-java ] | |
rbx-master [ x86_64 ] | |
=> ruby-1.8.7-p352 [ x86_64 ] | |
ruby-1.9.2-p290 [ x86_64 ] | |
new-host-3% sudo uninstall rbx-master | |
sudo: uninstall: command not found | |
new-host-3% sudo rvm uninstall rbx-master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new-host-3% rvm install rbx | |
rbx-head installing #dependencies | |
Cloning git://github.com/rubinius/rubinius.git | |
mkdir: /Users/andrewwagner/.rvm/log/rbx-head: Permission denied | |
touch: /Users/andrewwagner/.rvm/log/rbx-head/rbx.repo.log: No such file or directory | |
/Users/andrewwagner/.rvm/scripts/functions/utility: line 152: /Users/andrewwagner/.rvm/log/rbx-head/rbx.repo.log: No such file or directory | |
/Users/andrewwagner/.rvm/scripts/functions/utility: line 159: /Users/andrewwagner/.rvm/log/rbx-head/rbx.repo.log: No such file or directory | |
ERROR: Error running 'git clone --depth 1 git://github.com/rubinius/rubinius.git /Users/andrewwagner/.rvm/repos/rbx-head', please read /Users/andrewwagner/.rvm/log/rbx-head/rbx.repo.log | |
Could not fetch git://github.com/rubinius/rubinius.git - trying http://github.com/rubinius/rubinius.git | |
Cloning http://github.com/rubinius/rubinius.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new-host-3% rvm install rbx | |
rbx-head installing #dependencies | |
Cloning git://github.com/rubinius/rubinius.git | |
Copying from repo to source... | |
rbx-head - #configuring | |
rbx-head - #compiling | |
rbx-head - adjusting #shebangs for (erb ri rdoc). | |
rbx-head - #importing default gemsets (/Users/andrewwagner/.rvm/gemsets/) | |
WARN: rbx rbx-head-head is not installed. | |
To install do: 'rvm install rbx-head-head' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec' | |
require "rspec/core/rake_task" | |
RSpec::Core::RakeTask.new(:core) do |t| | |
t.rspec_opts = "-t ~foo" | |
end | |
describe "foo", :foo => true do | |
it "should be awesome" do | |
puts "foooooo!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> class Foo; def a; end; end | |
=> nil | |
>> class Bar < Foo; def a; super; end; end | |
=> nil | |
>> Bar.new.a | |
=> nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/andrewwagner> which ruby | |
ruby not found | |
/Users/andrewwagner> rvm list | |
rvm rubies | |
ruby-1.9.2-p290 [ i386 ] | |
/Users/andrewwagner> rvm use 1.9.2 | |
Using /Users/andrewwagner/.rvm/gems/ruby-1.9.2-p290 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProceduralFiveDigits | |
def initialize | |
@new_population = Array.new(100) { generate_individual } | |
reset | |
end | |
def evolve | |
1000.times do | |
100.times do | |
@parent_a, @parent_b = [pick_individual, pick_individual] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I found http://groups.google.com/group/growing-object-oriented-software/browse_thread/thread/47695af2c6b5adda fascinating, so I decided to make it a little more concrete. It's also in ruby using rspec, sorry about that. Here's the code under test: | |
class EligibleForDiscountPolicy | |
def initialize transaction, user | |
@transaction = transaction | |
@user = user | |
end | |
def decide | |
return true if @user.is_gold_member? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def not | |
3 | |
end | |
end | |
Foo.new.instance_eval { not } #=> syntax error, unexpected '}' | |
Foo.new.instance_eval { not() } #=> true | |
Foo.new.send :not #=> 3 |