Sha256: e1090b98ec6c4cb28ae6f25585d5c0b7f4c2df66bd17fc510a099756321c92f2

Contents?: true

Size: 1002 Bytes

Versions: 4

Compression:

Stored size: 1002 Bytes

Contents

module WWMD
  class VSStubs::VSReadValue
    include VSStubHelpers

    attr_accessor :value

    def initialize(val)
      @value = val
    end

    def serialize
      stack = super
      case self.to_sym
        when :int16;       stack << self.write_short(self.value)
        when :int32;       stack << self.write_7bit_encoded_int(self.value)
        when :byte;        stack << self.write_byte(self.value)
        when :char;        stack << self.write_byte(self.value)
        when :date_time;   stack << self.write_double(self.value)
        when :double;      stack << self.write_double(self.value)
        when :single;      stack << self.write_single(self.value)
        when :color;       stack << self.write_int32(self.value)
        when :known_color; stack << self.write_7bit_encoded_int(self.value)
        else; raise "unimplemented #{self.to_sym}"
      end
      return stack
    end

    def to_xml
      xml = super
      xml.add_text(self.value.to_s)
      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_read_value.rb
miketracy-wwmd-0.2.17 lib/wwmd/viewstate/vs_stubs/vs_read_value.rb
miketracy-wwmd-0.2.19 lib/wwmd/viewstate/vs_stubs/vs_read_value.rb
wwmd-0.2.20.3 lib/wwmd/viewstate/vs_stubs/vs_read_value.rb