Class: Blender3d::FixedLengthStringType

Inherits:
Object
  • Object
show all
Defined in:
lib/blender-3d/types.rb

Overview

equivalent to ArrayType<SimpleType<char>, length> (char)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(length) ⇒ FixedLengthStringType

Returns a new instance of FixedLengthStringType.



100
101
102
# File 'lib/blender-3d/types.rb', line 100

def initialize(length)
  @length = length
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



98
99
100
# File 'lib/blender-3d/types.rb', line 98

def length
  @length
end

Instance Method Details

#inspectObject



108
109
110
# File 'lib/blender-3d/types.rb', line 108

def inspect
  "char[#@length]"
end

#read(reader) ⇒ Object



112
113
114
# File 'lib/blender-3d/types.rb', line 112

def read(reader)
  reader.read(@length).gsub(/\0.*$/, '')
end

#to_sObject



104
105
106
# File 'lib/blender-3d/types.rb', line 104

def to_s
  "FixedLengthString(#@length)"
end