# skmetz/poodr

Remove trailing whitespace

skmetz committed Dec 9, 2012
1 parent 79e858c commit 124ab6442938136b965409b2c28c615e621d8df5
Showing with 440 additions and 440 deletions.
1. +22 −22 chapter_2.rb
2. +30 −30 chapter_3.rb
3. +22 −22 chapter_5.rb
4. +131 −131 chapter_6.rb
5. +12 −12 chapter_7.rb
6. +117 −117 chapter_8.rb
7. +8 −8 chapter_9a.rb
8. +14 −14 chapter_9b.rb
9. +11 −11 chapter_9d.rb
10. +15 −15 chapter_9e.rb
11. +20 −20 chapter_9f.rb
12. +11 −11 chapter_9g.rb
13. +27 −27 chapter_9h.rb
 @@ -1,11 +1,11 @@ ############## Page 18 ############## chainring = 52 # number of teeth -cog = 11 +cog = 11 ratio = chainring / cog.to_f puts ratio # -> 4.72727272727273 -chainring = 30 -cog = 27 +chainring = 30 +cog = 27 ratio = chainring / cog.to_f puts ratio # -> 1.11111111111111 @@ -16,14 +16,14 @@ def initialize(chainring, cog) @chainring = chainring @cog = cog end - + def ratio chainring / cog.to_f end end puts Gear.new(52, 11).ratio # -> 4.72727272727273 -puts Gear.new(30, 27).ratio # -> 1.11111111111111 +puts Gear.new(30, 27).ratio # -> 1.11111111111111 ############## Page 20 ############## class Gear @@ -34,7 +34,7 @@ def initialize(chainring, cog, rim, tire) @rim = rim @tire = tire end - + def ratio chainring / cog.to_f end @@ -45,10 +45,10 @@ def gear_inches end end -puts Gear.new(52, 11, 26, 1.5).gear_inches +puts Gear.new(52, 11, 26, 1.5).gear_inches # -> 137.090909090909 -puts Gear.new(52, 11, 24, 1.25).gear_inches +puts Gear.new(52, 11, 24, 1.25).gear_inches # -> 125.272727272727 ############## Page 20 ############## @@ -107,14 +107,14 @@ class ObscuringReferences def initialize(data) @data = data end - + def diameters # 0 is rim, 1 is tire - data.collect {|cell| + data.collect {|cell| cell[0] + (cell[1] * 2)} end # ... many other methods that index into the array -end +end ############## Page 27 ############## # rim and tire sizes (now in milimeters!) in a 2d array @@ -128,21 +128,21 @@ def initialize(data) end def diameters - wheels.collect {|wheel| + wheels.collect {|wheel| wheel.rim + (wheel.tire * 2)} end # ... now everyone can send rim/tire to wheel Wheel = Struct.new(:rim, :tire) def wheelify(data) - data.collect {|cell| + data.collect {|cell| Wheel.new(cell[0], cell[1])} end end ############## Page 29 ############## def diameters - wheels.collect {|wheel| + wheels.collect {|wheel| wheel.rim + (wheel.tire * 2)} end @@ -167,7 +167,7 @@ def gear_inches def gear_inches ratio * diameter end - + def diameter rim + (tire * 2) end @@ -180,7 +180,7 @@ def initialize(chainring, cog, rim, tire) @cog = cog @wheel = Wheel.new(rim, tire) end - + def ratio chainring / cog.to_f end @@ -204,7 +204,7 @@ def initialize(chainring, cog, wheel=nil) @cog = cog @wheel = wheel end - + def ratio chainring / cog.to_f end @@ -216,12 +216,12 @@ def gear_inches class Wheel attr_reader :rim, :tire - + def initialize(rim, tire) @rim = rim @tire = tire end - + def diameter rim + (tire * 2) end @@ -232,12 +232,12 @@ def circumference end @wheel = Wheel.new(26, 1.5) -puts @wheel.circumference +puts @wheel.circumference # -> 91.106186954104 -puts Gear.new(52, 11, @wheel).gear_inches +puts Gear.new(52, 11, @wheel).gear_inches # -> 137.090909090909 -puts Gear.new(52, 11).ratio +puts Gear.new(52, 11).ratio # -> 4.72727272727273
 @@ -11,7 +11,7 @@ def initialize(chainring, cog, rim, tire) def gear_inches ratio * Wheel.new(rim, tire).diameter end - + def ratio chainring / cog.to_f end @@ -24,14 +24,14 @@ def initialize(rim, tire) @rim = rim @tire = tire end - + def diameter rim + (tire * 2) end # ... end -Gear.new(52, 11, 26, 1.5).gear_inches +Gear.new(52, 11, 26, 1.5).gear_inches ############## Page 39 ############## class Gear @@ -42,14 +42,14 @@ def initialize(chainring, cog, rim, tire) @rim = rim @tire = tire end - + def gear_inches ratio * Wheel.new(rim, tire).diameter end # ... end -Gear.new(52, 11, 26, 1.5).gear_inches +Gear.new(52, 11, 26, 1.5).gear_inches ############## Page 41 ############## class Gear @@ -59,15 +59,15 @@ def initialize(chainring, cog, wheel) @cog = cog @wheel = wheel end - + def gear_inches ratio * wheel.diameter end # ... end # Gear expects a 'Duck' that knows 'diameter' -Gear.new(52, 11, Wheel.new(26, 1.5)).gear_inches +Gear.new(52, 11, Wheel.new(26, 1.5)).gear_inches ############## Page 43 ############## class Gear @@ -77,7 +77,7 @@ def initialize(chainring, cog, rim, tire) @cog = cog @wheel = Wheel.new(rim, tire) end - + def gear_inches ratio * wheel.diameter end @@ -92,11 +92,11 @@ def initialize(chainring, cog, rim, tire) @rim = rim @tire = tire end - + def gear_inches ratio * wheel.diameter end - + def wheel @wheel ||= Wheel.new(rim, tire) end @@ -137,8 +137,8 @@ def initialize(chainring, cog, wheel) end Gear.new( - 52, - 11, + 52, + 11, Wheel.new(26, 1.5)).gear_inches ############## Page 47 ############## @@ -153,9 +153,9 @@ def initialize(args) end Gear.new( - :chainring => 52, - :cog => 11, - :wheel => Wheel.new(26, 1.5)).gear_inches + :chainring => 52, + :cog => 11, + :wheel => Wheel.new(26, 1.5)).gear_inches ############## Page 48 ############## # specifying defaults using || @@ -180,7 +180,7 @@ def initialize(args) @chainring = args[:chainring] # ... end - + def defaults {:chainring => 40, :cog => 18} end @@ -196,22 +196,22 @@ def initialize(chainring, cog, wheel) @wheel = wheel end # ... - end + end end # wrap the interface to protect yourself from changes module GearWrapper def self.gear(args) - SomeFramework::Gear.new(args[:chainring], - args[:cog], + SomeFramework::Gear.new(args[:chainring], + args[:cog], args[:wheel]) end end # Now you can create a new Gear using an arguments hash. GearWrapper.gear( - :chainring => 52, - :cog => 11, + :chainring => 52, + :cog => 11, :wheel => Wheel.new(26, 1.5)).gear_inches ############## Page ?? ############## @@ -228,7 +228,7 @@ def initialize(chainring, cog, wheel) def gear_inches ratio * wheel.diameter end - + def ratio chainring / cog.to_f end @@ -241,23 +241,23 @@ def initialize(rim, tire) @rim = rim @tire = tire end - + def diameter rim + (tire * 2) end end module GearWrapper def self.gear(args) - SomeFramework::Gear.new(args[:chainring], - args[:cog], + SomeFramework::Gear.new(args[:chainring], + args[:cog], args[:wheel]) end end GearWrapper.gear( - :chainring => 52, - :cog => 11, + :chainring => 52, + :cog => 11, :wheel => Wheel.new(26, 1.5)).gear_inches ############## Page 52 ############## @@ -285,15 +285,15 @@ def initialize(rim, tire, chainring, cog) @tire = tire @gear = Gear.new(chainring, cog) end - + def diameter rim + (tire * 2) end - + def gear_inches gear.gear_inches(diameter) end # ... end -Wheel.new(26, 1.5, 52, 11).gear_inches +Wheel.new(26, 1.5, 52, 11).gear_inches