struct Units::Unit
- Units::Unit
- Struct
- Value
- Object
Included Modules
- Comparable(Units::Unit)
- Units::Compatible
Defined in:
units/unit.crConstructors
- .new(terms : Array(Term) = [] of Term)
- .new(term : Term)
- .new(unit : String, search : Mode = Mode::PrimaryCode)
Instance Method Summary
- #*(other : Unit | Term | Number)
- #**(other : Number) : Unit
- #/(other : Unit | Term | Number)
- #atoms
- #depth : Int32
- #magnitude(scalar = scalar()) : BigDecimal
- #operate(operator : Operation, other : Unit | Term | Number) : Unit
- #root_terms : Array(Term)
- #scalar(magnitude : Number = 1) : BigDecimal
- #special? : Bool
- #terms : Array(Term)
-
#to_s(mode : Mode = Mode::PrimaryCode)
Returns a nicely readable and concise string representation of this object, typically intended for users.
-
#to_s(io : IO) : Nil
Same as
#inspect(io)
.
Instance methods inherited from module Units::Compatible
<=>(other)
<=>,
compatible_with?(other)
compatible_with?,
composition : Multiset(String)
composition,
composition_string : String
composition_string,
dimension
dimension
Constructor Detail
Instance Method Detail
Description copied from class Object
Returns a nicely readable and concise string representation of this object, typically intended for users.
This method should usually not be overridden. It delegates to
#to_s(IO)
which can be overridden for custom implementations.
Also see #inspect
.