Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
Parameter passing across two files
-
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.
-
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 #modulefile: "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 #modulefile: "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 -
Great!
Thank you Dan.
Advertisement