Because that isn’t a valid line of code. You don’t close the
double-quotes.
Specifically, the second double quote is actually not the ASCII quote
character used by most programming languages; it’s a closing “curly”
quote.
But I don’t see why that would make irb accept the line and print “=>
nil”.
Because that isn’t a valid line of code. You don’t close the
double-quotes.
Er, what? Yes I did. If it werent valid code, it would have thrown an
error, not returned nil.
Oh, I see. Something screwed up the second quotations during the paste.
And, more to the point, thats an example. I tested Ruby many ways to
confirm it just flat-out doesnt work.
something’.class == String
=>false
is another example. What caused me to have to run this silliness down in
the first place was when my case statements started malfunctioning;
case thingamabob
when Fixnum then this-and-that
when String then something-else
when Array then another-option
end
Suddenly my code was unable to figure out what a string was.
At this point, the evidence I have here is that its just a gigantic bug
in Ruby. Installing the just-released 1.9.3p545 version made the problem
go away. Now I just have to figure out how to get Ubuntu to use the
right version . . . sigh.
As you can see, Fixnum is unaffected but String instances report nil as
class.
At this point, the evidence I have here is that it’s just a gigantic bug in
Ruby. Installing the just-released 1.9.3p545 version made the problem go away. Now
I just have to figure out how to get Ubuntu to use the right version . . . sigh.
No, it must have to do with your environment as Hassan said already.
You seem to be on Apple; there have been numerous reports that Ruby
and Applet are a difficult couple. Maybe it has something to do with
that.
$ ruby -e ‘p “foo”.class’
String
What happens if you do that?
Kind regards
robert
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.