Beginner Question - ?/

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

···

--
Posted via http://www.ruby-forum.com/.

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

-a

···

On Tue, 18 Apr 2006, Bihal wrote:

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

--
Posted via http://www.ruby-forum.com/\.

--
be kind whenever possible... it is always possible.
- h.h. the 14th dali lama

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

···

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
--

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

--
Posted via http://www.ruby-forum.com/\.