Because that isn't a valid line of code. You don't close the
double-quotes.
Er, what? Yes I did. If it weren’t 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, that’s an example. I tested Ruby many ways to confirm it just flat-out doesn’t 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 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.
···
On Mar 10, 2014, at 12:32 , Joel Pearson <lists@ruby-forum.com> wrote:
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".
···
On Mon, Mar 10, 2014 at 2:32 PM, Joel Pearson <lists@ruby-forum.com> wrote:
Because that isn't a valid line of code. You don't close the
double-quotes.
And, more to the point, that's an example. I tested Ruby many ways to confirm it just flat-out doesn't 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.
Yeah, that's bad.
Here's an example how you can produce the output you are observing:
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
···
On Tue, Mar 11, 2014 at 12:50 AM, Dave Howell <groups.2009a@grandfenwick.net> wrote:
On Mar 10, 2014, at 12:32 , Joel Pearson <lists@ruby-forum.com> wrote: