Class: EleetScript::NamespaceContext
Instance Attribute Summary collapse
Attributes inherited from BaseContext
#constants, #current_class, #current_self, #local_vars, #namespaces
Instance Method Summary
collapse
Methods inherited from BaseContext
#[], #[]=, #class_vars, init_with, #initialize, #instance_vars, #local_constant, #local_var, #method_missing, #respond_to_missing?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class EleetScript::BaseContext
Instance Attribute Details
#global_vars ⇒ Object
Returns the value of attribute global_vars.
151
152
153
|
# File 'lib/lang/runtime/context.rb', line 151
def global_vars
@global_vars
end
|
Instance Method Details
#add_namespace(name, value) ⇒ Object
163
164
165
|
# File 'lib/lang/runtime/context.rb', line 163
def add_namespace(name, value)
@namespaces[name] = value
end
|
#es_nil ⇒ Object
175
176
177
|
# File 'lib/lang/runtime/context.rb', line 175
def es_nil
@root_ns["nil"]
end
|
#namespace(name) ⇒ Object
155
156
157
158
159
160
161
|
# File 'lib/lang/runtime/context.rb', line 155
def namespace(name)
ns = @namespaces[name]
if ns.nil? && @parent_context
ns = @parent_context.namespaces[ns]
end
ns
end
|
#namespace_context ⇒ Object
183
184
185
|
# File 'lib/lang/runtime/context.rb', line 183
def namespace_context
self
end
|
#new_class_context(current_self, current_class = nil) ⇒ Object
187
188
189
190
191
|
# File 'lib/lang/runtime/context.rb', line 187
def new_class_context(current_self, current_class = nil)
ctx = ClassContext.new(current_self, current_class)
ctx.parent_context = self
ctx
end
|
#new_namespace_context ⇒ Object
193
194
195
196
197
198
199
|
# File 'lib/lang/runtime/context.rb', line 193
def new_namespace_context
ctx = NamespaceContext.new(nil, nil, @root_ns)
ctx.current_self = @root_ns["Object"].new(ctx)
ctx.current_class = current_self.runtime_class
ctx.parent_context = self
ctx
end
|
#root_ns ⇒ Object
179
180
181
|
# File 'lib/lang/runtime/context.rb', line 179
def root_ns
@root_ns
end
|