Module: Unitwise::Expression
- Defined in:
- lib/unitwise/expression.rb,
lib/unitwise/expression/parser.rb,
lib/unitwise/expression/matcher.rb,
lib/unitwise/expression/composer.rb,
lib/unitwise/expression/decomposer.rb,
lib/unitwise/expression/transformer.rb
Overview
The Expression module encompases all functions around encoding and decoding strings into Measurement::Units and vice-versa.
Defined Under Namespace
Classes: Composer, Decomposer, Matcher, Parser, Transformer
Class Method Summary collapse
-
.compose(terms, method = :primary_code) ⇒ String
Build a string representation of a collection of terms.
-
.decompose(expression) ⇒ Array
Convert a string representation of a unit into an array of terms.
Class Method Details
.compose(terms, method = :primary_code) ⇒ String
Build a string representation of a collection of terms
18 19 20 |
# File 'lib/unitwise/expression.rb', line 18 def compose(terms, method = :primary_code) Composer.new(terms, method).expression end |
.decompose(expression) ⇒ Array
Convert a string representation of a unit into an array of terms
29 30 31 |
# File 'lib/unitwise/expression.rb', line 29 def decompose(expression) Decomposer.parse(expression) end |