struct Units::Atom

Included Modules

Defined in:

units/atom.cr

Constructors

Class Method Summary

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(name : String | Array(String), symbol : Nil | String, primary_code : String, secondary_code : String, property : String, scale : Units::Scale | Nil = nil, metric : Bool = true, special : Bool = false, arbitrary : Bool = false, dimension : Nil | String = nil, classification : Nil | String = nil) #

[View source]

Class Method Detail

def self.all : Set(Atom) #

[View source]
def self.find(string : String, method : Mode = Mode::PrimaryCode) #

[View source]
def self.register(atom : Atom) #

[View source]

Instance Method Detail

def arbitrary? : Bool #

[View source]
def base? #

[View source]
def depth : Int32 #

[View source]
def derived? #

[View source]
def dimension #

[View source]
def magnitude(scalar = nil) #

[View source]
def metric? : Bool #

[View source]
def name : Array(String) #

[View source]
def primary_code : String #

[View source]
def property : String #

[View source]
def register #

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

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

Get a numeric value that can be used to with other atoms to compare with or operate on. Base units have a scalar of 1.


[View source]
def scale : Scale #

[View source]
def scale? : Scale | Nil #

[View source]
def secondary_code : String #

[View source]
def special? : Bool #

[View source]
def symbol : String | Nil #

[View source]
def terminal? #

[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]