The Inline module is the top-level module used. It is responsible for instantiating the builder for the right language used, compilation/linking when needed, and loading the inlined code into the current namespace.
# File lib/inline.rb, line 136 136: def self.directory 137: directory = File.join(rootdir, ".ruby_inline") 138: unless defined? @@directory and directory == @@directory 139: @@directory = File.join(self.rootdir, ".ruby_inline") 140: end 141: Dir.assert_secure directory 142: @@directory 143: end
# File lib/inline.rb, line 84 84: def self.register cls 85: registered_inline_classes << cls 86: registered_inline_classes.uniq! 87: end
# File lib/inline.rb, line 89 89: def self.registered_inline_classes 90: @@registered_inline_classes ||= [] 91: end
rootdir can be forced using INLINEDIR variable if not defined, it should store in user HOME folder
Under Windows user data can be stored in several locations:
HOME HOMEDRIVE + HOMEPATH APPDATA USERPROFILE
Perform a check in that other to see if the environment is defined and if so, use it. only try this on Windows.
# File lib/inline.rb, line 106 106: def self.rootdir 107: env = ENV['INLINEDIR'] || ENV['HOME'] 108: 109: if env.nil? and WINDOZE then 110: # try HOMEDRIVE + HOMEPATH combination 111: if ENV['HOMEDRIVE'] && ENV['HOMEPATH'] then 112: env = ENV['HOMEDRIVE'] + ENV['HOMEPATH'] 113: end 114: 115: # no HOMEDRIVE? use APPDATA 116: env = ENV['APPDATA'] if env.nil? and ENV['APPDATA'] 117: 118: # bummer, still no env? then fall to USERPROFILE 119: env = ENV['USERPROFILE'] if env.nil? and ENV['USERPROFILE'] 120: end 121: 122: if env.nil? then 123: abort "Define INLINEDIR or HOME in your environment and try again" 124: end 125: 126: unless defined? @@rootdir and env == @@rootdir and test dd, @@rootdir then 127: rootdir = env 128: Dir.mkdir rootdir, 0700 unless test dd, rootdir 129: Dir.assert_secure rootdir 130: @@rootdir = rootdir 131: end 132: 133: @@rootdir 134: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.