Class: Ruby::SerialString

Inherits:
Object
  • Object
show all
Includes:
SerialData
Defined in:
lib/ruby/proto.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerialData

byteArrayToInt, intToByteArray, #loadInt16, #loadInt32, #loadInt8, #storeInt16, #storeInt32, #storeInt8

Constructor Details

#initialize(_value = "") ⇒ SerialString

Returns a new instance of SerialString.



134
135
136
# File 'lib/ruby/proto.rb', line 134

def initialize(_value = "")
  resetString(_value)
end

Instance Attribute Details

#read_indexObject (readonly)

Returns the value of attribute read_index.



132
133
134
# File 'lib/ruby/proto.rb', line 132

def read_index
  @read_index
end

#strObject (readonly)

Returns the value of attribute str.



132
133
134
# File 'lib/ruby/proto.rb', line 132

def str
  @str
end

Instance Method Details

#resetString(_value = "") ⇒ Object



138
139
140
141
142
143
144
# File 'lib/ruby/proto.rb', line 138

def resetString(_value = "")
  @str = ""
  @str.encode!("binary")
  _value = _value || ""
  @str <<_value
  @read_index = 0
end