How to share variables across my .rb files?

前端 未结 4 1189
轻奢々
轻奢々 2020-12-13 18:20

I have a few .rb files and I want to use the same variables in all of them. Let\'s say variable test_variable = \"test\" should be accessible from

4条回答
  •  执笔经年
    2020-12-13 19:10

    You shouldn't need to wrap these variables in a module.

    Simply adding them to another_file.rb and using require_relative 'another_file' (if it's in the same directory) or require 'path/to/another_file' should be sufficient to share those variables across files.

提交回复
热议问题