Class: Unity::Quantity

Inherits:
Object
  • Object
show all
Includes:
Arithmetic, Conversion, Dimension::Vector
Defined in:
lib/unity/quantity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Arithmetic

#*, #+, #-, #/, #coerce

Methods included from Conversion

#convert_to

Methods included from Fraction

#expanded_denominator, #expanded_numerator, #expression, #expression=, #inverse, #reduce, #unit

Methods included from Comparison

#==, #compatible!, #compatible?

Methods included from Dimension::Integer

#dimension_int, #property, #property_name

Methods included from Dimension::Vector

#dimension_vector

Constructor Details

#initialize(attributes = {}) ⇒ Quantity

Returns a new instance of Quantity.



9
10
11
12
13
14
# File 'lib/unity/quantity.rb', line 9

def initialize(attributes = {})
  attributes.each do |name, value|
    send("#{name}=", value)
  end
  super
end

Instance Attribute Details

#cached_expressionObject

Returns the value of attribute cached_expression.



16
17
18
# File 'lib/unity/quantity.rb', line 16

def cached_expression
  @cached_expression
end

#denominatorObject

Returns the value of attribute denominator.



16
17
18
# File 'lib/unity/quantity.rb', line 16

def denominator
  @denominator
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/unity/quantity.rb', line 16

def name
  @name
end

#numeratorObject

Returns the value of attribute numerator.



16
17
18
# File 'lib/unity/quantity.rb', line 16

def numerator
  @numerator
end

#valueObject

Returns the value of attribute value.



16
17
18
# File 'lib/unity/quantity.rb', line 16

def value
  @value
end