W
Warren Seltzer
------=_NextPart_000_00A3_01C5D983.FB188B00
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
The following failure surprised me:
Version 1:
irb(main):068:0> "hi".class == "hi".class
=> true
irb(main):069:0> "hi".class === "hi".class
=> false
Version 2:
irb(main):055:0> case "whatever".class
irb(main):056:1> when String
irb(main):057:1> p "it is a string"
irb(main):058:1> else
irb(main):059:1* p "it is not a string"
irb(main):060:1> end
"it is not a string"
What it amounts to is you can't use case/when to test for class. This is a HUGE LOSE.
The pickaxe book .chm says YOU CAN do it. I'm using ruby 1.8.2
Warren
------=_NextPart_000_00A3_01C5D983.FB188B00--
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
The following failure surprised me:
Version 1:
irb(main):068:0> "hi".class == "hi".class
=> true
irb(main):069:0> "hi".class === "hi".class
=> false
Version 2:
irb(main):055:0> case "whatever".class
irb(main):056:1> when String
irb(main):057:1> p "it is a string"
irb(main):058:1> else
irb(main):059:1* p "it is not a string"
irb(main):060:1> end
"it is not a string"
What it amounts to is you can't use case/when to test for class. This is a HUGE LOSE.
The pickaxe book .chm says YOU CAN do it. I'm using ruby 1.8.2
Warren
------=_NextPart_000_00A3_01C5D983.FB188B00--