struct Units::Unit

Included Modules

Defined in:

units/unit.cr

Constructors

Instance Method Summary

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

def self.new(terms : Array(Term) = [] of Term) #

[View source]
def self.new(term : Term) #

[View source]
def self.new(unit : String, search : Mode = Mode::PrimaryCode) #

[View source]

Instance Method Detail

def *(other : Unit | Term | Number) #

[View source]
def **(other : Number) : Unit #

[View source]
def /(other : Unit | Term | Number) #

[View source]
def atoms #

[View source]
def depth : Int32 #

[View source]
def magnitude(scalar = scalar()) : BigDecimal #

[View source]
def operate(operator : Operation, other : Unit | Term | Number) : Unit #

[View source]
def root_terms : Array(Term) #

[View source]
def scalar(magnitude : Number = 1) : BigDecimal #

[View source]
def special? : Bool #

[View source]
def terms : Array(Term) #

[View source]
def to_s(mode : Mode = Mode::PrimaryCode) #
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.


[View source]
def to_s(io : IO) : Nil #
Description copied from struct Struct

Same as #inspect(io).


[View source]