Class: Blender3d::FixedLengthStringType
- Inherits:
-
Object
- Object
- Blender3d::FixedLengthStringType
- Defined in:
- lib/blender-3d/types.rb
Overview
equivalent to ArrayType<SimpleType<char>, length> (char)
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
Returns the value of attribute length.
Instance Method Summary collapse
-
#initialize(length) ⇒ FixedLengthStringType
constructor
A new instance of FixedLengthStringType.
- #inspect ⇒ Object
- #read(reader) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(length) ⇒ FixedLengthStringType
Returns a new instance of FixedLengthStringType.
127 128 129 |
# File 'lib/blender-3d/types.rb', line 127 def initialize(length) @length = length end |
Instance Attribute Details
#length ⇒ Object (readonly)
Returns the value of attribute length.
125 126 127 |
# File 'lib/blender-3d/types.rb', line 125 def length @length end |
Instance Method Details
#inspect ⇒ Object
135 136 137 |
# File 'lib/blender-3d/types.rb', line 135 def inspect "char[#@length]" end |
#read(reader) ⇒ Object
139 140 141 |
# File 'lib/blender-3d/types.rb', line 139 def read(reader) reader.read(@length).gsub(/\0.*$/, '') end |
#to_s ⇒ Object
131 132 133 |
# File 'lib/blender-3d/types.rb', line 131 def to_s "FixedLengthString(#@length)" end |