Class: Unitwise::Functional
Instance Attribute Summary collapse
-
#function ⇒ Object
readonly
Returns the value of attribute function.
Attributes inherited from Scale
Instance Method Summary collapse
- #functional(x = scalar, direction = 1) ⇒ Object
-
#initialize(value, unit, function_name) ⇒ Functional
constructor
A new instance of Functional.
- #scalar ⇒ Object
Methods inherited from Scale
#atoms, #depth, #dup, #inspect, #root_terms, #special?, #terminal?, #terms, #to_s, #unit
Methods included from Composable
#<=>, #composition, #composition_string, #dim, included, #similar_to?
Constructor Details
#initialize(value, unit, function_name) ⇒ Functional
Returns a new instance of Functional.
6 7 8 9 |
# File 'lib/unitwise/functional.rb', line 6 def initialize(value, unit, function_name) super(value, unit) @function = Function.find(function_name) end |
Instance Attribute Details
#function ⇒ Object (readonly)
Returns the value of attribute function.
4 5 6 |
# File 'lib/unitwise/functional.rb', line 4 def function @function end |
Instance Method Details
#functional(x = scalar, direction = 1) ⇒ Object
16 17 18 |
# File 'lib/unitwise/functional.rb', line 16 def functional(x=scalar, direction=1) function.functional(x, direction) end |
#scalar ⇒ Object
11 12 13 14 |
# File 'lib/unitwise/functional.rb', line 11 def scalar puts "Warning: Mathematical operations with special units not reccomended by UCUM." super() end |