module RubyUnits::Array
Extra methods for [::Array] to support conversion to [RubyUnits::Unit]
Public Instance Methods
to_unit(other = nil)
click to toggle source
Construct a unit from an array
@example [1, ‘mm’].to_unit => RubyUnits::Unit.new
(“1 mm”) @param [RubyUnits::Unit, String] other convert to same units as passed @return [RubyUnits::Unit]
# File lib/ruby_units/array.rb, line 11 def to_unit(other = nil) other ? RubyUnits::Unit.new(self).convert_to(other) : RubyUnits::Unit.new(self) end