Method: RubyUnits::Unit#to_i
- Defined in:
- lib/ruby_units/unit.rb
#to_i ⇒ Integer Also known as: to_int
if unitless, returns an int, otherwise raises an error
1245 1246 1247 1248 1249 |
# File 'lib/ruby_units/unit.rb', line 1245 def to_i return @scalar.to_int if unitless? raise "Cannot convert '#{self}' to Integer unless unitless. Use Unit#scalar" end |