Module: VIN::LuaScript
- Defined in:
- lib/vin/lua_script.rb
Constant Summary collapse
- LUA_SCRIPT_PATH =
"lua/id-generation.lua.erb".freeze
Class Method Summary collapse
- .generate_file(config: nil) ⇒ Object
-
.reset_cache ⇒ Object
Used in tests to ensure that the file is regenerated.
Class Method Details
.generate_file(config: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vin/lua_script.rb', line 8 def self.generate_file(config: nil) config ||= VIN::Config.new binding = binding() binding.local_variable_set(:config, config) @generate_file ||= ERB.new( File.read( File.("../../#{LUA_SCRIPT_PATH}", File.dirname(__FILE__)), ), ).result(binding) end |
.reset_cache ⇒ Object
Used in tests to ensure that the file is regenerated.
20 21 22 |
# File 'lib/vin/lua_script.rb', line 20 def self.reset_cache @generate_file = nil end |