From: "Michael T. Richter" Date: 2008-04-14T22:29:14+09:00 Subject: Stupid question about the Stick gem. --=-EygfuRDdatpkI6ArhKTJ Content-Type: multipart/alternative; boundary="=-R/QUUDJeh125Nhm/Xjmn" --=-R/QUUDJeh125Nhm/Xjmn Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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(yd**2) 1.acre.to(sq_yd) 1.gallon.to(self.L) 1.lb.to(kg) 1.m.s.to(m.s) 1.sq_mi.to(km**2) 1.mile.to(km) 1.usd.to(twd) Cutting and pasting that very code into irb: irb(main):003:0> require 'stick/units' =3D> 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? --=20 Michael T. Richter (GoogleTalk: ttmrichter@gmail.com) So much of what we call management consists in making it difficult for people to work. (Peter Drucker) --=-R/QUUDJeh125Nhm/Xjmn Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 "<= A HREF=3D"http://stick.rubyforge.org/rdoc/index.html">http://stick.rubyforg= e.org/rdoc/index.html" I get the following snippet of code (the ob= vious 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(yd**2)
1.acre.to(sq_yd)
1.gallon.to(self.L)
1.lb.to(kg)
1.m.s.to(m.s)
1.sq_mi.to(km**2)
1.mile.to(km)
1.usd.to(twd)

Cutting and pasting that very code into irb:

irb(main):003:0> require 'stick/units'
=3D> 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 th= e 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 s= tick to work?

--
Michael T. Richter <ttmri= chter@gmail.com> (GoogleTalk: ttmrichter@gmail.com)
So much of what we call management consists in making it difficult for p= eople to work. (Peter Drucker)
--=-R/QUUDJeh125Nhm/Xjmn-- --=-EygfuRDdatpkI6ArhKTJ Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBIA1wVLqyWkKVQ54QRAq4sAJ0RxBqK9//iuRzHyIJMwaz8MnEJ7wCcDvBv n2wZ0hAktILZYgA812LotRs= =2mQn -----END PGP SIGNATURE----- --=-EygfuRDdatpkI6ArhKTJ--