Sha256: 67c4b3743fc0b2d249259fd1e8cb583102995fff0c13b22b4d20978566498c0a

Contents?: true

Size: 860 Bytes

Versions: 4

Compression:

Stored size: 860 Bytes

Contents

module WWMD
  class VSStubs::VSHashtable
    include VSStubHelpers

    attr_accessor :value

    def initialize()
      @value = []
    end

    def add(obj1,obj2)
      @value << [obj1,obj2]
    end

    def serialize
      stack = super
      stack << self.write_7bit_encoded_int(self.size)
      self.value.each do |k,v|
        stack << k.serialize
        stack << v.serialize
      end 
      return stack
    end

    def to_xml
      xml = super
      xml.add_attribute("size",self.value.size.to_s)
      self.value.each do |k,v|
        pair = REXML::Element.new("Pair")
        key = REXML::Element.new("Key")
        key.add_element(k.to_xml)
        val = REXML::Element.new("Value")
        val.add_element(v.to_xml)
        pair.add_element(key)
        pair.add_element(val)
        xml.add_element(pair)
      end
      xml
    end

  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
iZsh-wwmd-0.2.19 lib/wwmd/viewstate/vs_stubs/vs_hashtable.rb
miketracy-wwmd-0.2.17 lib/wwmd/viewstate/vs_stubs/vs_hashtable.rb
miketracy-wwmd-0.2.19 lib/wwmd/viewstate/vs_stubs/vs_hashtable.rb
wwmd-0.2.20.3 lib/wwmd/viewstate/vs_stubs/vs_hashtable.rb