elementy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +28 -2
- data/lib/elementy.rb +9 -0
- data/lib/elementy/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Elementy
|
2
2
|
|
3
|
-
|
3
|
+
This is a simple gem to lookup elements in the periodic table.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,33 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Usage is pretty simple:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'elementy'
|
25
|
+
|
26
|
+
Elementy.search 2
|
27
|
+
# => #<Elementy::Element @group="Element Noble p", @position=17, @number=2, @name="Helium", @molar=4.002602, @symbol="He", @electrons=[2]>
|
28
|
+
|
29
|
+
Elementy.search 'C'
|
30
|
+
# => #<Elementy::Element:0x007fab5bb352f0 @group="Element Nonmetal Carbon p", @position=13, @number=6, @name="Carbon", @molar=12.0107, @symbol="C", @electrons=[2, 4]>
|
31
|
+
|
32
|
+
Elementy.search 'einsteinium'
|
33
|
+
# => #<Elementy::Element @group="Element Actinoid f", @position=12, @number=99, @name="Einsteinium", @molar=252, @symbol="Es", @electrons=[2, 8, 18, 32, 29, 8, 2]>
|
34
|
+
```
|
35
|
+
|
36
|
+
You can also use it on the command line
|
37
|
+
|
38
|
+
```bash
|
39
|
+
$ elementy 42
|
40
|
+
symbol: Mo
|
41
|
+
name: Molybdenum
|
42
|
+
number: 42
|
43
|
+
molar: 95.96
|
44
|
+
position: 5
|
45
|
+
group: Element Transition d
|
46
|
+
electrons: [2, 8, 18, 13, 1]
|
47
|
+
```
|
22
48
|
|
23
49
|
## Contributing
|
24
50
|
|
data/lib/elementy.rb
CHANGED
@@ -6,5 +6,14 @@ module Elementy
|
|
6
6
|
def root
|
7
7
|
File.dirname(File.dirname(__FILE__))
|
8
8
|
end
|
9
|
+
|
10
|
+
# Searches for and returns and element if found.
|
11
|
+
#
|
12
|
+
# @param term [string, symbol, integer] the name, symbol, or atomic
|
13
|
+
# number to search for
|
14
|
+
# @return [Elementy::Element]
|
15
|
+
def search(term)
|
16
|
+
Elementy::Element.search term
|
17
|
+
end
|
9
18
|
end
|
10
19
|
end
|
data/lib/elementy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elementy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|