lib/eulim/chemistry/element.rb in eulim-0.0.10 vs lib/eulim/chemistry/element.rb in eulim-0.0.11
- old
+ new
@@ -1,6 +1,7 @@
require 'csv'
+require 'unitwise'
module Eulim
module Chemistry
# This class has functionality for elements
# Ex: symbol, atomic mass, atomic number
@@ -13,10 +14,10 @@
def initialize(arg)
@name = arg[1]
@symbol = arg[0]
@atomic_number = arg[2].to_i
- @atomic_mass = arg[3].to_f
+ @atomic_mass = Unitwise(arg[3].to_f, 'u')
end
# elements of the csv have no spaces
CSV.foreach(File.join(File.dirname(__FILE__), 'elements.csv'), headers: true) do |row|
ELEMENTS << new(row)