sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Access to Ruby standard library from scripts?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 524 Views 3 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.
    • C Offline
      crudolph
      last edited by

      I posted this a week ago to the google group but that seems to get almost zero traffic.

      Apologies if this has been posted and answered already.

      I'm trying to utilize the CSV class from the 1.8.7 standard library [http://ruby-doc.org/stdlib-1.8.7/libdoc/csv/rdoc/CSV.html]. However 'require csv.rb' leads to an unknown file error. I also tried to link directly to the 1.8 lib directory on my machine [for me it's /usr/lib/ruby/1.8 and ruby --version returns => ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

      Am I doing something wrong or is this not supported?

      Thanks in advance,
      Chris.

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        @crudolph said:

        Am I doing something wrong or is this not supported?

        Both, partially,
        Firstly, I am by no means an expert on the subject, just an over zealous mac hacker...
        Sketchup's 'require' doesn't include the 'standard ruby' in it's load path array, you need to tell SU where to look...
        and a couple of other things.

        some things can be 'loaded' on there own using a full path, but others won't work without additional requires...
        some can be copied into a relative folder, with the same proviso.

        It is possible to switch between SU's 1.8.5 ruby and the Systems 1.8.7 ruby and there is a ruby beta that adds a reload so you can do it on the fly.

        BUT, it all depends on your end game.

        if your distributing a plugin, I wouldn't use ruby switching, it has some hiccups (including potential loss of system ruby, which might annoy your users)

        There are more details in other threads, so have a dig, fill in your user profile and post some details of what you need to achieve, then we can help more...
        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          Standard Library isn't compatible with SketchUp Ruby. For instance, the Set class that SketchUp bundle isn't compatible with the STL Set class.

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          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