Class: EleetScript::EleetScriptArray
- Inherits:
-
EleetScriptClass
- Object
- EleetScriptClassSkeleton
- EleetScriptClass
- EleetScript::EleetScriptArray
- Defined in:
- lib/lang/runtime/array.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Attributes inherited from EleetScriptClass
#class_vars, #context, #methods, #name, #super_class
Attributes inherited from EleetScriptClassSkeleton
Instance Method Summary collapse
-
#initialize(memory, super_class = nil) ⇒ EleetScriptArray
constructor
A new instance of EleetScriptArray.
- #to_s ⇒ Object
Methods inherited from EleetScriptClass
#call, #class_def, create, #def, #es_responds_to?, #inspect, #instance_lookup, #lookup, #new, #new_with_value, #super_call
Methods inherited from EleetScriptClassSkeleton
#class?, #eql?, #instance?, #is_a?, set_is_class, set_is_instance
Constructor Details
#initialize(memory, super_class = nil) ⇒ EleetScriptArray
Returns a new instance of EleetScriptArray.
5 6 7 8 9 |
# File 'lib/lang/runtime/array.rb', line 5 def initialize(memory, super_class = nil) super(memory, super_class) @hash = {} @array = [] end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
3 4 5 |
# File 'lib/lang/runtime/array.rb', line 3 def array @array end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
3 4 5 |
# File 'lib/lang/runtime/array.rb', line 3 def hash @hash end |
Instance Method Details
#to_s ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/lang/runtime/array.rb', line 11 def to_s str = "<EleetScriptArray" hash_data = @hash.map do |key, value| "#{key}=#{value}" end data = @array.dup.concat(hash_data) if data.length > 0 str += "[" + data.join(", ") + "]" end str + ">" end |