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

    Parameter passing across two files

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

      Hello,

      can somebody say how to pass a parameter across two files in ruby?
      To be exact it's a variable, which contains a string.
      The string changes its value at the runtime.
      Is there a problem with sketchup?

      Thank you.

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        file: "chris88/chris88_mod.rb"

        module Chris88
        
          @@common_var_name = "some string value"
        
          # create a getter method for @@common_var_name
          #
          def self.common_var_name()
            return @@common_var_name
          end #def method
        
        end #module
        

        file: "chris88/plugin_one.rb"

        require("chris88/chris88_mod.rb")
        
        module Chris88;;PluginOne
        
          local_var_name = Chris88.common_var_name()
          # local_var_name is pointing at the SAME string object that
          #  Chris88;;@@common_var_name is also pointing at.
        
          # If you wish a copy then;
          local_var_copy = Chris88.common_var_name().dup
        
        end #module
        

        file: "chris88/plugin_two.rb"

        require("chris88/chris88_mod.rb")
        
        module Chris88;;PluginTwo
        
          puts( "The value of my common string is; #{Chris88.common_var_name()}" )
        
        end #module
        

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • C Offline
          Chris88
          last edited by

          Great!
          Thank you Dan.

          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