Class: Blender3d::ArrayType

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, size) ⇒ ArrayType

Returns a new instance of ArrayType.



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

def initialize(type, size)
  @type, @size = type, size
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



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

def size
  @size
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#dimensionsObject



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

def dimensions
  @sizes.size
end

#inspectObject



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

def inspect
  "#{@type.inspect}[#@size]"
end

#read(reader) ⇒ Object



21
22
23
# File 'lib/blender-3d/types/array_type.rb', line 21

def read(reader)
  @size.times.map { @type.read(reader) }
end

#to_sObject



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

def to_s
  "Array[#@size](#@type)"
end