Method: UnitMeasurements::UnitGroup#unit_with_name_and_aliases
- Defined in:
- lib/unit_measurements/unit_group.rb
#unit_with_name_and_aliases ⇒ Hash (private)
Returns a hash where keys are unit names (including aliases) and values are corresponding Unit instances.
278 279 280 281 282 |
# File 'lib/unit_measurements/unit_group.rb', line 278 def unit_with_name_and_aliases units.each_with_object({}) do |unit, hash| unit.names.each { |name| hash[name.to_s] = unit } end end |