Sha256: acfce8cabdabc5e337087932b35926f88253fd4026786a652a1e671c1e6b0bfb

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

require "mspire/isotope/version"

module Mspire
  class Isotope
    class << self
      attr_accessor :element_hash
      def by_element(element)
        element_hash[element]
      end
      alias_method :[], :by_element
    end
    MEMBERS = [
      :atomic_number, 
      :element, 
      :mass_number, 
      :atomic_mass, 
      :relative_abundance, 
      :average_mass, 
      :mono
    ].each {|key| attr_accessor key }

    def initialize(*args)
      MEMBERS.zip(args) {|k,val| self.send("#{k}=", val) }
    end
  end
end


# sets Mspire::Isotope::BY_ELEMENTS and Mspire::Isotope::ISOTOPES
require 'mspire/isotope/neese'
module Mspire
  class Isotope
    BY_ELEMENT = Mspire::Isotope::Neese::BY_ELEMENT
    ISOTOPES = Mspire::Isotope::Neese::ISOTOPES

    self.element_hash = Mspire::Isotope::Neese::BY_ELEMENT
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mspire-isotope-0.1.0 lib/mspire/isotope.rb