Class: Unitsml::Unitsdb::Dimension

Inherits:
Object
  • Object
show all
Defined in:
lib/unitsml/unitsdb/dimension.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDimension

Returns a new instance of Dimension.



22
23
24
25
26
# File 'lib/unitsml/unitsdb/dimension.rb', line 22

def initialize
  @parsables = {}
  @processed_keys = []
  @parsable = false
end

Instance Attribute Details

#amount_of_substanceObject

Returns the value of attribute amount_of_substance.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def amount_of_substance
  @amount_of_substance
end

#dimensionlessObject

Returns the value of attribute dimensionless.



6
7
8
# File 'lib/unitsml/unitsdb/dimension.rb', line 6

def dimensionless
  @dimensionless
end

#electric_currentObject

Returns the value of attribute electric_current.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def electric_current
  @electric_current
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/unitsml/unitsdb/dimension.rb', line 6

def id
  @id
end

#lengthObject

Returns the value of attribute length.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def length
  @length
end

#luminous_intensityObject

Returns the value of attribute luminous_intensity.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def luminous_intensity
  @luminous_intensity
end

#massObject

Returns the value of attribute mass.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def mass
  @mass
end

#parsableObject (readonly)

Returns the value of attribute parsable.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def parsable
  @parsable
end

#parsablesObject (readonly)

Returns the value of attribute parsables.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def parsables
  @parsables
end

#plane_angleObject

Returns the value of attribute plane_angle.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def plane_angle
  @plane_angle
end

#processed_keysObject (readonly)

Returns the value of attribute processed_keys.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def processed_keys
  @processed_keys
end

#thermodynamic_temperatureObject

Returns the value of attribute thermodynamic_temperature.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def thermodynamic_temperature
  @thermodynamic_temperature
end

#timeObject

Returns the value of attribute time.



10
11
12
# File 'lib/unitsml/unitsdb/dimension.rb', line 10

def time
  @time
end

#vectorObject

Returns the value of attribute vector.



6
7
8
# File 'lib/unitsml/unitsdb/dimension.rb', line 6

def vector
  @vector
end

Instance Method Details

#dim_symbolsObject



60
61
62
# File 'lib/unitsml/unitsdb/dimension.rb', line 60

def dim_symbols
  processed_keys.map { |vec| public_send(vec)&.dim_symbols&.map(&:id) }.flatten.compact
end

#processed_symbolObject



64
65
66
# File 'lib/unitsml/unitsdb/dimension.rb', line 64

def processed_symbol
  public_send(processed_keys.first).symbol
end

#set_vectorObject



68
69
70
71
72
# File 'lib/unitsml/unitsdb/dimension.rb', line 68

def set_vector
  @vector ||= Utility::DIMS_VECTOR.map do |h|
    public_send(Utility.underscore(h))&.power_numerator
  end.join(":")
end