Class: Blender3d::Pointer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ Pointer

Returns a new instance of Pointer.



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

def initialize(location)
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



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

def location
  @location
end

Instance Method Details

#<=>(other) ⇒ Object



19
20
21
# File 'lib/blender-3d/pointer.rb', line 19

def <=>(other)
  other.is_a?(Pointer) ? location <=> other.location : 1
end

#==(other) ⇒ Object



23
24
25
# File 'lib/blender-3d/pointer.rb', line 23

def ==(other)
  (self <=> other) == 0
end

#inspectObject



13
14
15
16
17
# File 'lib/blender-3d/pointer.rb', line 13

def inspect
  return '0x0' if @location == 0
  return '0x%08x' % @location if @location < (1 << 32)
  '0x%016x' % @location
end

#to_sObject



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

def to_s
  "Pointer(#{inspect})"
end