Skip to content

Instantly share code, notes, and snippets.

@isaacsanders
Created August 6, 2012 00:12
Show Gist options
  • Save isaacsanders/3268341 to your computer and use it in GitHub Desktop.
Save isaacsanders/3268341 to your computer and use it in GitHub Desktop.
Defining an element with Chemistry
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