Class: Laser::Cutter::Geometry::Dimensions

Inherits:
Tuple
  • Object
show all
Defined in:
lib/laser/cutter/geometry/dimensions.rb

Overview

The width, height and depth of a box, written as "WxHxD".

Constant Summary

Constants inherited from Tuple

Tuple::PRECISION

Instance Attribute Summary

Attributes inherited from Tuple

#coords

Instance Method Summary collapse

Methods inherited from Tuple

#+, #<, #<=>, #>, #[], #clone, #eql?, #initialize, #to_a, #to_s, #valid?, #x, #x=, #y, #y=

Constructor Details

This class inherits a constructor from Laser::Cutter::Geometry::Tuple

Instance Method Details

#d ⇒ Float

Returns the depth.

Returns:

  • (Float) —

    the depth



20
21
22
# File 'lib/laser/cutter/geometry/dimensions.rb', line 20

def d
  coords.[](2)
end

#h ⇒ Float

Returns the height.

Returns:

  • (Float) —

    the height



15
16
17
# File 'lib/laser/cutter/geometry/dimensions.rb', line 15

def h
  coords.[](1)
end

#hash_keys ⇒ Array<Symbol>

Returns the keys a Hash of dimensions uses.

Returns:

  • (Array<Symbol>) —

    the keys a Hash of dimensions uses



30
31
32
# File 'lib/laser/cutter/geometry/dimensions.rb', line 30

def hash_keys
  [:w, :h, :d]
end

#separator ⇒ String

Returns the separator between the values in a String.

Returns:

  • (String) —

    the separator between the values in a String



25
26
27
# File 'lib/laser/cutter/geometry/dimensions.rb', line 25

def separator
  'x'
end

#w ⇒ Float

Returns the width.

Returns:

  • (Float) —

    the width



10
11
12
# File 'lib/laser/cutter/geometry/dimensions.rb', line 10

def w
  coords.[](0)
end