Sha256: 2ff4da7b3dc9ac9eda9ad1b69b39dfce31294866e88d8da5109abd37af37a5e0
Contents?: true
Size: 664 Bytes
Versions: 1
Compression:
Stored size: 664 Bytes
Contents
# frozen_string_literal: true module RubyUnits # Extra methods for [::Array] to support conversion to [RubyUnits::Unit] module Array # 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] def to_unit(other = nil) other ? RubyUnits::Unit.new(self).convert_to(other) : RubyUnits::Unit.new(self) end end end # @note Do this instead of Array.prepend(RubyUnits::Array) to avoid YARD warnings # @see https://github.com/lsegal/yard/issues/1353 class Array prepend(RubyUnits::Array) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-units-4.1.0 | lib/ruby_units/array.rb |