Sha256: d5a5c5fc2eb6a7cd6d354a3f4326e305795515b190f928c94023d25934622345

Contents?: true

Size: 692 Bytes

Versions: 4

Compression:

Stored size: 692 Bytes

Contents

module WWMD
  class VSStubs::VSString
    include VSStubHelpers

    attr_accessor :value

    def initialize(val)
      @value = val
    end

    def serialize
      stack = super
      stack << self.write_7bit_encoded_int(self.size)
      stack << self.value
      return stack
    end

    def to_xml
      xml = super
      # emit quoted-printable if we need to
      if self.value =~ /[^\x20-\x7e]/
#        xml.add_attribute("encoding","quoted-printable")
#        xml.add_text(self.value.to_qp)
        xml.add_attribute("encoding","urlencoded")
        xml.add_text(self.value.escape(/[^\x20-\x7e]/))
      else
        xml.add_text(self.value)
      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_string.rb
miketracy-wwmd-0.2.17 lib/wwmd/viewstate/vs_stubs/vs_string.rb
miketracy-wwmd-0.2.19 lib/wwmd/viewstate/vs_stubs/vs_string.rb
wwmd-0.2.20.3 lib/wwmd/viewstate/vs_stubs/vs_string.rb