Module: WWMD::VSStubHelpers

Instance Method Summary collapse

Methods included from ViewStateUtils

#deserialize_type, #dlog, #magic?, #next_type, #offset, #putd, #read, #read_7bit_encoded_int, #read_double, #read_int, #read_int32, #read_raw_byte, #read_short, #read_string, #serialize_type, #slog, #throw, #write_7bit_encoded_int, #write_double, #write_int, #write_int32, #write_short

Instance Method Details

#opcodeObject



9
10
11
# File 'lib/wwmd/viewstate/vs_stubs/vs_stub_helpers.rb', line 9

def opcode
  return VIEWSTATE_TYPES.index(self.to_sym)
end

#serializeObject



17
18
19
20
21
22
23
24
# File 'lib/wwmd/viewstate/vs_stubs/vs_stub_helpers.rb', line 17

def serialize
  stack = ""
  stack << self.write_byte(self.opcode)
  if self.respond_to?(:typeref)
    stack << self.serialize_type(self.typeref,self.typeval)
  end
  return stack
end

#sizeObject



13
14
15
# File 'lib/wwmd/viewstate/vs_stubs/vs_stub_helpers.rb', line 13

def size
  return @value.size
end

#to_symObject



5
6
7
# File 'lib/wwmd/viewstate/vs_stubs/vs_stub_helpers.rb', line 5

def to_sym
  self.class.to_s.split(":").last.gsub(/[A-Z]+/,'\1_\0').downcase[1..-1].gsub(/\Avs/,"").to_sym
end

#to_xmlObject



26
27
28
29
30
31
32
33
34
# File 'lib/wwmd/viewstate/vs_stubs/vs_stub_helpers.rb', line 26

def to_xml
  xml = REXML::Element.new(self.class.to_s.split(":").last)
  if self.respond_to?(:typeref)
    xml.add_attribute("typeref",self.typeref)
    xml.add_attribute("typeval",self.typeval)
  end
#      xml.add_attribute("size",self.size)
  xml
end