Sha256: ae6d4f8b57d248c4546e4b607b6ddb6fd5bca201b0bb2d27ab2dc5fe33132865
Contents?: true
Size: 858 Bytes
Versions: 1
Compression:
Stored size: 858 Bytes
Contents
module Alumina # Each of the elements has a singleton instance of this class. You do not # create instances of this class; they are loaded from a data file. class Element # @return [Fixnum] The element's atomic number (hydrogen is 1). attr_reader :atomic_number # @return [String] The element's name. attr_reader :name # @return [String] The element's symbol (hydrogen is @H@). attr_reader :symbol # @private def initialize(atomic_number, name, symbol) @atomic_number = atomic_number @name = name @symbol = symbol end # Provides a natural ordering based on atomic number. # # @param [Element] other The other element to compare against. # @return [-1, 0, 1] The sort equivalency. def <=>(other) atomic_number <=> other.atomic_number end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alumina-0.0.1 | lib/alumina/element.rb |