Class: Unitwise::Functional

Inherits:
Scale
  • Object
show all
Defined in:
lib/unitwise/functional.rb

Instance Attribute Summary collapse

Attributes inherited from Scale

#value

Instance Method Summary collapse

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

#functionObject (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

#scalarObject



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