Class: WWMD::VSStubs::VSReadValue
- Inherits:
-
Object
- Object
- WWMD::VSStubs::VSReadValue
- Includes:
- WWMD::VSStubHelpers
- Defined in:
- lib/wwmd/viewstate/vs_stubs/vs_read_value.rb
Direct Known Subclasses
VSByte, VSChar, VSColor, VSDateTime, VSDouble, VSInt16, VSInt32, VSKnownColor, VSSingle
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(val) ⇒ VSReadValue
constructor
A new instance of VSReadValue.
- #serialize ⇒ Object
- #to_xml ⇒ Object
Methods included from WWMD::VSStubHelpers
Methods included from WWMD::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
Constructor Details
#initialize(val) ⇒ VSReadValue
Returns a new instance of VSReadValue.
7 8 9 |
# File 'lib/wwmd/viewstate/vs_stubs/vs_read_value.rb', line 7 def initialize(val) @value = val end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/wwmd/viewstate/vs_stubs/vs_read_value.rb', line 5 def value @value end |
Instance Method Details
#serialize ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wwmd/viewstate/vs_stubs/vs_read_value.rb', line 11 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 |
#to_xml ⇒ Object
28 29 30 31 32 |
# File 'lib/wwmd/viewstate/vs_stubs/vs_read_value.rb', line 28 def to_xml xml = super xml.add_text(self.value.to_s) xml end |