elt 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 86d703509ea9c17d7dde8bff3c29104144a3040d
4
+ data.tar.gz: 19e9fff94267c627f81bc9301e52d6e081c5719d
5
+ SHA512:
6
+ metadata.gz: 488f91474d7e3dee530e9e3b883326256d4c06170ca717491a30b6668a9e3f2045907bbe2cdea2486d237c67055bde4dcbe931e2c2c56c574b6e08030be51a35
7
+ data.tar.gz: d703cae8208c69bb396df0df520b1f2dde7a16a8a4bbf0e00d2c308aad6c8f003fa1c4d1337e985554ba0a94df1f2856cc2e0aea0319333c4c471d10db9050ac
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in elt.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Yoteichi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ # Elt
2
+
3
+ A program to print a short description of chemical elements.
4
+
5
+
6
+ ## Installation
7
+
8
+ $ gem install elt
9
+
10
+ ## Usage
11
+
12
+ The `elt` command will recognize the atomic number, name or symbol of an
13
+ element.
14
+
15
+ $ elt 1
16
+ 1 Hydrogen H
17
+
18
+ $ elt Molybdenum
19
+ 42 Molybdenum Mo
20
+
21
+ $ elt Uuo
22
+ 118 Ununoctium Uuo
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it ( https://github.com/plonk/elt/fork )
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/elt ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'elt'
4
+
5
+ Elt::Elt.new.run
6
+
@@ -0,0 +1,118 @@
1
+ 1 Hydrogen H
2
+ 2 Helium He
3
+ 3 Lithium Li
4
+ 4 Beryllium Be
5
+ 5 Boron B
6
+ 6 Carbon C
7
+ 7 Nitrogen N
8
+ 8 Oxygen O
9
+ 9 Fluorine F
10
+ 10 Neon Ne
11
+ 11 Sodium Na
12
+ 12 Magnesium Mg
13
+ 13 Aluminium Al
14
+ 14 Silicon Si
15
+ 15 Phosphorus P
16
+ 16 Sulfur S
17
+ 17 Chlorine Cl
18
+ 18 Argon Ar
19
+ 19 Potassium K
20
+ 20 Calcium Ca
21
+ 21 Scandium Sc
22
+ 22 Titanium Ti
23
+ 23 Vanadium V
24
+ 24 Chromium Cr
25
+ 25 Manganese Mn
26
+ 26 Iron Fe
27
+ 27 Cobalt Co
28
+ 28 Nickel Ni
29
+ 29 Copper Cu
30
+ 30 Zinc Zn
31
+ 31 Gallium Ga
32
+ 32 Germanium Ge
33
+ 33 Arsenic As
34
+ 34 Selenium Se
35
+ 35 Bromine Br
36
+ 36 Krypton Kr
37
+ 37 Rubidium Rb
38
+ 38 Strontium Sr
39
+ 39 Yttrium Y
40
+ 40 Zirconium Zr
41
+ 41 Niobium Nb
42
+ 42 Molybdenum Mo
43
+ 43 Technetium Tc
44
+ 44 Ruthenium Ru
45
+ 45 Rhodium Rh
46
+ 46 Palladium Pd
47
+ 47 Silver Ag
48
+ 48 Cadmium Cd
49
+ 49 Indium In
50
+ 50 Tin Sn
51
+ 51 Antimony Sb
52
+ 52 Tellurium Te
53
+ 53 Iodine I
54
+ 54 Xenon Xe
55
+ 55 Caesium Cs
56
+ 56 Barium Ba
57
+ 57 Lanthanum La
58
+ 58 Cerium Ce
59
+ 59 Praseodymium Pr
60
+ 60 Neodymium Nd
61
+ 61 Promethium Pm
62
+ 62 Samarium Sm
63
+ 63 Europium Eu
64
+ 64 Gadolinium Gd
65
+ 65 Terbium Tb
66
+ 66 Dysprosium Dy
67
+ 67 Holmium Ho
68
+ 68 Erbium Er
69
+ 69 Thulium Tm
70
+ 70 Ytterbium Yb
71
+ 71 Lutetium Lu
72
+ 72 Hafnium Hf
73
+ 73 Tantalum Ta
74
+ 74 Tungsten W
75
+ 75 Rhenium Re
76
+ 76 Osmium Os
77
+ 77 Iridium Ir
78
+ 78 Platinum Pt
79
+ 79 Gold Au
80
+ 80 Mercury Hg
81
+ 81 Thallium Tl
82
+ 82 Lead Pb
83
+ 83 Bismuth Bi
84
+ 84 Polonium Po
85
+ 85 Astatine At
86
+ 86 Radon Rn
87
+ 87 Francium Fr
88
+ 88 Radium Ra
89
+ 89 Actinium Ac
90
+ 90 Thorium Th
91
+ 91 Protactinium Pa
92
+ 92 Uranium U
93
+ 93 Neptunium Np
94
+ 94 Plutonium Pu
95
+ 95 Americium Am
96
+ 96 Curium Cm
97
+ 97 Berkelium Bk
98
+ 98 Californium Cf
99
+ 99 Einsteinium Es
100
+ 100 Fermium Fm
101
+ 101 Mendelevium Md
102
+ 102 Nobelium No
103
+ 103 Lawrencium Lr
104
+ 104 Rutherfordium Rf
105
+ 105 Dubnium Db
106
+ 106 Seaborgium Sg
107
+ 107 Bohrium Bh
108
+ 108 Hassium Hs
109
+ 109 Meitnerium Mt
110
+ 110 Darmstadtium Ds
111
+ 111 Roentgenium Rg
112
+ 112 Copernicium Cn
113
+ 113 Ununtrium Uut
114
+ 114 Flerovium Fl
115
+ 115 Ununpentium Uup
116
+ 116 Livermorium Lv
117
+ 117 Ununseptium Uus
118
+ 118 Ununoctium Uuo
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'elt/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "elt"
8
+ spec.version = Elt::VERSION
9
+ spec.authors = ["Yoteichi"]
10
+ spec.email = ["plonk@piano.email.ne.jp"]
11
+ spec.summary = %q{look up chemical elements}
12
+ spec.description = %q{}
13
+ spec.homepage = "https://github.com/plonk/elt"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,44 @@
1
+ module Elt
2
+
3
+ class Elt
4
+ def initialize
5
+ gemdir = File.dirname File.dirname __FILE__
6
+ @dictionary_path = gemdir + '/' + 'elements.txt'
7
+ end
8
+
9
+ def lookup(term)
10
+ File.open(@dictionary_path, 'r') do |dict|
11
+ dict.each_line do |line_nl|
12
+ row = line_nl.chomp.split
13
+ if row.include?(term)
14
+ return row
15
+ end
16
+ end
17
+ end
18
+ return nil
19
+ end
20
+
21
+ def show((atomic_number, name, symbol))
22
+ puts "#{atomic_number} #{name} #{symbol}"
23
+ end
24
+
25
+ def usage
26
+ puts "Usage: elt NAME_NUMBER_OR_SYMBOL"
27
+ end
28
+
29
+ def run
30
+ case ARGV.size
31
+ when 1
32
+ row = lookup(ARGV[0])
33
+ if row
34
+ show(row)
35
+ else
36
+ puts 'Not found'
37
+ end
38
+ else
39
+ usage
40
+ end
41
+ end
42
+ end
43
+
44
+ end
@@ -0,0 +1,3 @@
1
+ module Elt
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: elt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yoteichi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: ''
42
+ email:
43
+ - plonk@piano.email.ne.jp
44
+ executables:
45
+ - elt
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/elt
55
+ - elements.txt
56
+ - elt.gemspec
57
+ - lib/elt.rb
58
+ - lib/elt/version.rb
59
+ homepage: https://github.com/plonk/elt
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.4.8
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: look up chemical elements
83
+ test_files: []