Method: Atomy::Module#compile_context

Defined in:
lib/atomy/module.rb

#compile_contextObject



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/atomy/module.rb', line 107

def compile_context
  return @compile_context if @compile_context

  scope = Rubinius::LexicalScope.new(
    self,
    Rubinius::LexicalScope.new(Object))

  meth = proc {}.block.compiled_code
  meth. = nil
  meth.name = :__script__
  meth.scope = scope

  variables =
    Rubinius::VariableScope.synthesize(
      meth, self, nil, self, nil, Rubinius::Tuple.new(0))

  if @file
    script = meth.create_script
    script.file_path = @file.to_s
    script.data_path = File.expand_path(@file.to_s)
    script.make_main!

    scope.script = script
  end

  @compile_context = Binding.setup(variables, meth, scope)
end