Class: Unity::DerivedUnit

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, Conversion, Unity::Dimension::Vector
Defined in:
lib/unity/lookup/derived_unit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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 Unity::Dimension::Integer

#dimension_int, #property, #property_name

Methods included from Unity::Dimension::Vector

#dimension_vector

Constructor Details

#initialize(attributes = {}) ⇒ DerivedUnit

Returns a new instance of DerivedUnit.



15
16
17
18
19
20
# File 'lib/unity/lookup/derived_unit.rb', line 15

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

Instance Attribute Details

#denominatorObject

Returns the value of attribute denominator.



9
10
11
# File 'lib/unity/lookup/derived_unit.rb', line 9

def denominator
  @denominator
end

#nameObject Also known as: to_s

Returns the value of attribute name.



9
10
11
# File 'lib/unity/lookup/derived_unit.rb', line 9

def name
  @name
end

#numeratorObject

Returns the value of attribute numerator.



9
10
11
# File 'lib/unity/lookup/derived_unit.rb', line 9

def numerator
  @numerator
end

#valueObject

Returns the value of attribute value.



9
10
11
# File 'lib/unity/lookup/derived_unit.rb', line 9

def value
  @value
end