Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: liweinan/recipies
base: b17e2c8f9a
...
head fork: liweinan/recipies
compare: 07cb5240f5
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
13 ruby/cookbook/8-3.rb
@@ -0,0 +1,13 @@
+def append_to_self(x)
+ unless x.respond_to? :<<
+ raise ArgumentError, "Method not supported"
+ end
+ if x.is_a? Numeric
+ raise ArgumentError, "Numeric not supported"
+ end
+ x << x
+end
+
+puts append_to_self('abc')
+puts append_to_self([1,2,3])
+
View
7 ruby/rspec/start/Makefile
@@ -0,0 +1,7 @@
+RSPEC_OPT='-fd'
+
+.PHONY: test
+test: bowling.rb bowling_spec.rb
+ @$(rb19)
+ @rspec bowling_spec.rb $(RSPEC_OPT)
+
View
8 ruby/rspec/start/bowling.rb
@@ -0,0 +1,8 @@
+class Bowling
+ def hit(pins)
+ end
+
+ def score
+ 0
+ end
+end
View
11 ruby/rspec/start/bowling_spec.rb
@@ -0,0 +1,11 @@
+require './bowling.rb'
+
+describe Bowling, "#score" do
+ it "returns 0 for all gutter game" do
+ bowling = Bowling.new
+ 20.times { bowling.hit(0) }
+ bowling.score.should eq(0)
+ end
+end
+
+

No commit comments for this range

Something went wrong with that request. Please try again.