Class: Medidas::BaseUnit
- Inherits:
-
Unit
- Object
- Unit
- Medidas::BaseUnit
show all
- Defined in:
- lib/medidas/base_unit.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Unit
#*, #base_unit?, #coerce, #inspect, #name_for, registered_units, #to_s
Constructor Details
#initialize(name:, plural:) ⇒ BaseUnit
Returns a new instance of BaseUnit.
7
8
9
10
|
# File 'lib/medidas/base_unit.rb', line 7
def initialize(name:, plural: )
@name = name
@plural = plural
end
|
Class Method Details
.[](name, plural: "#{name}s") ⇒ Object
3
4
5
|
# File 'lib/medidas/base_unit.rb', line 3
def self.[](name, plural: "#{name}s")
registered_units[name] ||= new(name: name, plural: plural)
end
|
Instance Method Details
#base_unit ⇒ Object
12
13
14
|
# File 'lib/medidas/base_unit.rb', line 12
def base_unit
self
end
|
#factor ⇒ Object
16
17
18
|
# File 'lib/medidas/base_unit.rb', line 16
def factor
1
end
|