Class: VectorNumber::SpecialUnit

Inherits:
Object
  • Object
show all
Defined in:
lib/vector_number/special_unit.rb

Overview

Class for representing special units.

The public API consists of:

  • #==/#eql?/#equal? (from Object)

  • #hash (from Object)

  • #to_s

  • #inspect

Since:

  • 0.6.0

Instance Method Summary collapse

Constructor Details

#initialize(unit, text) ⇒ SpecialUnit

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SpecialUnit.

Parameters:

Since:

  • 0.6.0



17
18
19
20
# File 'lib/vector_number/special_unit.rb', line 17

def initialize(unit, text)
  @unit = unit
  @text = text
end

Instance Method Details

#inspectString

Get string representation of the unit for debugging.

Returns:

  • (String)

Since:

  • 0.6.0



32
33
34
# File 'lib/vector_number/special_unit.rb', line 32

def inspect
  "unit/#{@unit}"
end

#to_sString

Get predefined string representation of the unit.

Returns:

  • (String)

Since:

  • 0.6.0



25
26
27
# File 'lib/vector_number/special_unit.rb', line 25

def to_s
  @text
end