sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Embedded Quotes in Ruby Strings

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 264 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      MartinRinehart
      last edited by

      Don't read this. It's here for Google search to rescue someone.

      In the other languages I've used, from C through JavaScript, quotes were just characters within strings. The only issue was embedding them in string constants where you had to escape them.

      Not so in Ruby. It just wreaked havoc with a string-encoded bitmap I was passing from JavaScript. Changing the encoding base from 32 to 48 (48.chr == bits 000000) omits the quotes and solves the problem.

      Unencrypted source code for the bitmap-related classes is in the VisMap Ruby.

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      1 Reply Last reply Reply Quote 0
      • Al HartA Offline
        Al Hart
        last edited by

        One problem with encoding a binary string into 32 bit integers is that Ruby does not allow 32-bit integers. (It turns anything with more than 31 bits into a 64-bit bignum) And SketchUp doesn't seem to process BIGNUM at all. We wound up using base64 encoding .

        Al Hart

        http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
        IRender nXt from Render Plus

        1 Reply Last reply Reply Quote 0
        • M Offline
          MartinRinehart
          last edited by

          @al hart said:

          We wound up using base64 encoding.

          Great minds... Ruby had issues until I switched from chars 32-95 to 48-111.

          Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement