Method: RubyUnits::String#%

Defined in:
lib/ruby_units/string.rb

#%(*other) ⇒ String

Format unit output using formatting codes

Examples:

‘%0.2f’ % ‘1 mm’.to_unit => ‘1.00 mm’

Parameters:

Returns:



22
23
24
25
26
27
28
# File 'lib/ruby_units/string.rb', line 22

def %(*other)
  if other.first.is_a?(RubyUnits::Unit)
    other.first.to_s(self)
  else
    super
  end
end