Class: Blender3d::FixedLengthStringType

Inherits:
Object
  • Object
show all
Defined in:
lib/blender-3d/types/fixed_length_string_type.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.



6
7
8
# File 'lib/blender-3d/types/fixed_length_string_type.rb', line 6

def initialize(length)
  @length = length
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



4
5
6
# File 'lib/blender-3d/types/fixed_length_string_type.rb', line 4

def length
  @length
end

Instance Method Details

#inspectObject



14
15
16
# File 'lib/blender-3d/types/fixed_length_string_type.rb', line 14

def inspect
  "char[#@length]"
end

#read(reader) ⇒ Object



18
19
20
# File 'lib/blender-3d/types/fixed_length_string_type.rb', line 18

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

#to_sObject



10
11
12
# File 'lib/blender-3d/types/fixed_length_string_type.rb', line 10

def to_s
  "FixedLengthString(#@length)"
end