class EleetScript::ListBase

Attributes

array_value[RW]
hash_value[RW]

Public Class Methods

new() click to toggle source
# File lib/lang/runtime/base_classes.rb, line 9
def initialize
  @array_value = []
  @hash_value = {}
end

Public Instance Methods

clear() click to toggle source
# File lib/lang/runtime/base_classes.rb, line 41
def clear
  array_value.clear
  hash_value.clear
end
clone() click to toggle source
# File lib/lang/runtime/base_classes.rb, line 19
def clone
  dup
end
dup() click to toggle source
# File lib/lang/runtime/base_classes.rb, line 23
def dup
  ListBase.new.tap do |lst|
    lst.array_value = array_value.dup
    lst.hash_value = hash_value.dup
  end
end
merge!(o) click to toggle source
# File lib/lang/runtime/base_classes.rb, line 14
def merge!(o)
  array_value.concat(o.array_value)
  hash_value.merge!(o.hash_value)
end
to_h() click to toggle source
# File lib/lang/runtime/base_classes.rb, line 30
def to_h
  {}.tap do |hash|
    array_value.map.with_index do |value, index|
      hash[index] = value
    end
    hash_value.map do |key, value|
      hash[key] = value
    end
  end
end