Class: TestML::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/testml/runtime.rb

Overview


Constant Summary collapse

@@outer =
{}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFunction

Returns a new instance of Function.



268
269
270
# File 'lib/testml/runtime.rb', line 268

def initialize
  @statements = []
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



260
261
262
# File 'lib/testml/runtime.rb', line 260

def data
  @data
end

#namespaceObject

Returns the value of attribute namespace.



259
260
261
# File 'lib/testml/runtime.rb', line 259

def namespace
  @namespace
end

#signatureObject

Returns the value of attribute signature.



257
258
259
# File 'lib/testml/runtime.rb', line 257

def signature
  @signature
end

#statementsObject

Returns the value of attribute statements.



258
259
260
# File 'lib/testml/runtime.rb', line 258

def statements
  @statements
end

Instance Method Details

#forgetvar(name) ⇒ Object



287
288
289
# File 'lib/testml/runtime.rb', line 287

def forgetvar name
  namespace.delete name
end

#getvar(name) ⇒ Object



272
273
274
275
276
277
278
279
280
281
# File 'lib/testml/runtime.rb', line 272

def getvar name
  s = self
  while s
    if s.namespace.key? name
      return s.namespace[name]
    end
    s = s.outer
  end
  nil
end

#outerObject



263
# File 'lib/testml/runtime.rb', line 263

def outer; @@outer[self.object_id] end

#outer=(value) ⇒ Object



264
# File 'lib/testml/runtime.rb', line 264

def outer=(value); @@outer[self.object_id] = value end

#setvar(name, value) ⇒ Object



283
284
285
# File 'lib/testml/runtime.rb', line 283

def setvar name, value
  namespace[name] = value
end

#typeObject



265
# File 'lib/testml/runtime.rb', line 265

def type; 'Func' end