So, I installed the stick gem and gave it a run through its paces. I
stumbled at the first hurdle. From the documentation found at
“http://stick.rubyforge.org/rdoc/index.html” I get the following snippet
of code (the obvious spelling error of “require” corrected):
require ‘stick/units’
1.bit/s + 8.bytes/s
(1.bit/s).to(byte/s)
1.mile.to(feet)
1.acre.to(yd2)
1.acre.to(sq_yd)
1.gallon.to(self.L)
1.lb.to(kg)
1.m.s.to(m.s)
1.sq_mi.to(km2)
1.mile.to(km)
1.usd.to(twd)
Cutting and pasting that very code into irb:
irb(main):003:0> require ‘stick/units’
=> false
irb(main):004:0> 1.bit/s + 8.bytes/s
NameError: undefined local variable or method s' for main:Object from (irb):4 irb(main):005:0> (1.bit/s).to(byte/s) NameError: undefined local variable or method
s’ for main:Object
from (irb):5
irb(main):006:0> 1.mile.to(feet)
NameError: undefined local variable or method feet' for main:Object from (irb):6 irb(main):007:0> 1.acre.to(yd**2) NameError: undefined local variable or method
yd’ for main:Object
from (irb):7
irb(main):008:0> 1.acre.to(sq_yd)
NameError: undefined local variable or method sq_yd' for main:Object from (irb):8 irb(main):009:0> 1.gallon.to(self.L) NoMethodError: undefined method
L’ for main:Object
from (irb):9
irb(main):010:0> 1.lb.to(kg)
NameError: undefined local variable or method kg' for main:Object from (irb):10 irb(main):011:0> 1.m.s.to(m.s) NameError: undefined local variable or method
m’ for main:Object
from (irb):11
irb(main):012:0> 1.sq_mi.to(km**2)
NameError: undefined local variable or method km' for main:Object from (irb):12 irb(main):013:0> 1.mile.to(km) NameError: undefined local variable or method
km’ for main:Object
from (irb):13
irb(main):014:0> 1.usd.to(twd)
NoMethodError: undefined method `usd’ for 1:Fixnum
from (irb):14
Not a single one of the supplied examples works. Digging around in the
docs more closely finds me nothing to show what went wrong and the
source isn’t helping a whole lot either. So what’s the magic trick to
get stick to work?