Class: RubyCode

Inherits:
Code
  • Object
show all
Defined in:
lib/atk/info.rb

Overview

Ruby Code/Evaluation

Instance Method Summary collapse

Methods inherited from Code

#init_with, tags, #to_s

Instance Method Details

#run(*args) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/atk/info.rb', line 65

def run(*args)
    # FUTURE: generate this name to ensure there are never name conflicts
    temp_file = ".info_language_runner_cache.rb"
    # a file needs to be created in the root dir so that things like __dir__ work properly
    # the first line of the temp file deletes itself so that it appears as if no file ever existed
    IO.write(temp_file, "File.delete('./.info_language_runner_cache.rb')\n#{@value}")
    system("ruby", temp_file, *args)
end