Created
August 6, 2012 00:12
-
-
Save isaacsanders/3268341 to your computer and use it in GitHub Desktop.
Defining an element with Chemistry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'chemistry/element/dsl' | |
include Chemistry::Element::DSL | |
element 'Hydrogen' do | |
symbol 'H' | |
atomic_number 1 | |
atomic_weight 1.00794 | |
end | |
# This creates a class Chemistry::Element::Hydrogen | |
# An instance of the class will have methods that expose the | |
# data provided in the block. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment