Forum: Ruby Beginner Question - ?/

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
65b23f7757747463b55afc326956d27d?d=identicon&s=25 Bihal (Guest)
on 2006-04-18 03:47
Hey guys

Found a strange piece of code I haven't run into before.

     def redirect_to_directory_uri(req, res)
        if req.path[-1] != ?/
          location = req.path + "/"
          if req.query_string && req.query_string.size > 0
            location << "?" << req.query_string
          end
          res.set_redirect(HTTPStatus::MovedPermanently, location)
        end
      end

It's the "?/" on the second line that I don't understand. The only other
place I can find this is in one of the required files (used in the same
way) or at the end of a regular expression, but this is clearly not. I
have no idea what it is. Can anybody help?

Bihal
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 unknown (Guest)
on 2006-04-18 04:20
(Received via mailing list)
On Tue, 18 Apr 2006, Bihal wrote:

>          res.set_redirect(HTTPStatus::MovedPermanently, location)
> --
> Posted via http://www.ruby-forum.com/.

   harp:~ > ruby -e'  [ ?a, ?b, ?c ].each{|charcode| p charcode}  '
   97
   98
   99


-a
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-04-18 04:26
(Received via mailing list)
On Apr 17, 2006, at 10:18 PM, ara.t.howard@noaa.gov wrote:

>   harp:~ > ruby -e'  [ ?a, ?b, ?c ].each{|charcode| p charcode}  '
>   97
>   98
>   99
>
>
> -a
> --

And just in case this was a little cryptic, ?SOME_CHARACTER is the
ruby equivalent of C's 'SOME_CHARACTER' or Lisp's #\SOME_CHARACTER
65b23f7757747463b55afc326956d27d?d=identicon&s=25 Bihal (Guest)
on 2006-04-18 06:02
Logan Capaldo wrote:
> On Apr 17, 2006, at 10:18 PM, ara.t.howard@noaa.gov wrote:
>
>>   harp:~ > ruby -e'  [ ?a, ?b, ?c ].each{|charcode| p charcode}  '
>>   97
>>   98
>>   99
>>
>>
>> -a
>> --
>
> And just in case this was a little cryptic, ?SOME_CHARACTER is the
> ruby equivalent of C's 'SOME_CHARACTER' or Lisp's #\SOME_CHARACTER

Thanks guys!

Bihal
This topic is locked and can not be replied to.