greek_abc 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fc1ac0491d57cc13284cd601c0c306be25b44bfc0cbd2af9677e673e10d20df
4
- data.tar.gz: c4a1d19b22ef2295e683e80e1342bf94f87ba9501eb6d91e933721e34c7639a1
3
+ metadata.gz: 0d2b76467a2469de4cb7dc92eed9abe8974eb5e748fa1a3a39ef12585d29affc
4
+ data.tar.gz: 42d724856ef12297d74bf14404fb7e83d76c3b03f0bd50f799544da266b0c90c
5
5
  SHA512:
6
- metadata.gz: 54861250a44b312c47392f390f6c5a86e6c86dd314aabc53be43d276ef473828eee0ae06f1d7e45ccaa8c27b229b874a09c50268f0c8d43bba0647e98ca59728
7
- data.tar.gz: 348b95f8ced22907fa2319cbe653357330097ecd3ac94d4612df45f8fc0dd730dd4de41fe06aa12ae843286926378bed198a288245da510472011618cefa05be
6
+ metadata.gz: 19108c8f1b6910542a89fe7842d5de67c94270d42e3ef4dd8b6ffb7f35592d5aa927b340e02d4201b885470aa8458f3a3157fbd9da57908e98cad33bf98f1386
7
+ data.tar.gz: e01bfa0dc8e2e69c02d00e779e8f6ed415a0ba35565917bd4d54549a926834bc2c6d0272ce6b30cbf3842bae2ce707d9ac0603c8fe5b9b15c6d5bc126045b9cf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- greek_abc (0.2.1)
4
+ greek_abc (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -33,13 +33,38 @@ eta = abc.find_letter_by(position: 7) # => <..@lower="η", @name="Eta", @positio
33
33
  puts psi # => Letter #23 'Psi', lowercase 'ψ', uppercase 'Ψ'
34
34
  ```
35
35
 
36
- ### Get all letters
36
+ #### `Letter` methods
37
+
38
+ ```ruby
39
+ abc = GreekABC::Alphabet.new
40
+
41
+ omega = abc.find_letter_by(name: 'Omega').lower # => "ω"
42
+ omega = abc.find_letter_by(name: 'Omega').lower # => "Ω"
43
+ omega = abc.find_letter_by(name: 'Omega').position # => 24
44
+
45
+ alpha = abc.find_letter_by(position: 1).name # => "Alpha"
46
+ ```
47
+
48
+ #### Get all letters
37
49
 
38
50
  ```ruby
39
51
  abc = GreekABC::Alphabet.new
40
52
  puts abc.letters
41
53
  ```
42
54
 
55
+ Also get letters as a hash:
56
+
57
+ ```ruby
58
+ abc = GreekABC::Alphabet.new
59
+ puts abc.to_h # => {"Alpha"=>{:position=>1, :lower=>"α", :upper=>"Α"}
60
+ ```
61
+
62
+ Or a more basic hash from `GreekABC` module itself:
63
+
64
+ ```ruby
65
+ abc = GreekABC::ALPHABET # => {"Alpha"=>"α", "Beta"=>"β", ...}
66
+ ```
67
+
43
68
  ## Development
44
69
 
45
70
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -0,0 +1,33 @@
1
+ module GreekABC
2
+
3
+ ALPHABET = {
4
+ 'Alpha' => 'α',
5
+ 'Beta' => 'β',
6
+ 'Gamma' => 'γ',
7
+ 'Delta' => 'δ',
8
+ 'Epsilon' => 'ε',
9
+ 'Zeta' => 'ζ',
10
+ 'Eta' => 'η',
11
+ 'Theta' => 'θ',
12
+ 'Iota' => 'ι',
13
+ 'Kappa' => 'κ',
14
+ 'Lambda' => 'λ',
15
+ 'Mu' => 'μ',
16
+ 'Nu' => 'ν',
17
+ 'Xi' => 'ξ',
18
+ 'Omicron' => 'ο',
19
+ 'Pi' => 'π',
20
+ 'Rho' => 'ρ',
21
+ 'Sigma' => 'σ',
22
+ 'Tau' => 'τ',
23
+ 'Upsilon' => 'υ',
24
+ 'Phi' => 'φ',
25
+ 'Chi' => 'χ',
26
+ 'Psi' => 'ψ',
27
+ 'Omega' => 'ω'
28
+ }.freeze
29
+
30
+ LOWERS = ALPHABET.values.freeze
31
+ UPPERS = LOWERS.map(&:upcase).freeze
32
+ LOWERS_AND_UPPERS = (LOWERS + UPPERS).freeze
33
+ end
@@ -1,3 +1,3 @@
1
1
  module GreekABC
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/greek_abc.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'greek_abc/version'
2
+
3
+ require 'greek_abc/constants'
2
4
  require 'greek_abc/letter'
3
5
  require 'greek_abc/alphabet'
4
6
 
@@ -6,31 +8,4 @@ module GreekABC
6
8
  class GreekABCError < StandardError; end
7
9
  class LetterLookupError < GreekABCError; end
8
10
  class LetterNotFoundError < GreekABCError; end
9
-
10
- ALPHABET = {
11
- 'Alpha' => 'α',
12
- 'Beta' => 'β',
13
- 'Gamma' => 'γ',
14
- 'Delta' => 'δ',
15
- 'Epsilon' => 'ε',
16
- 'Zeta' => 'ζ',
17
- 'Eta' => 'η',
18
- 'Theta' => 'θ',
19
- 'Iota' => 'ι',
20
- 'Kappa' => 'κ',
21
- 'Lambda' => 'λ',
22
- 'Mu' => 'μ',
23
- 'Nu' => 'ν',
24
- 'Xi' => 'ξ',
25
- 'Omicron' => 'ο',
26
- 'Pi' => 'π',
27
- 'Rho' => 'ρ',
28
- 'Sigma' => 'σ',
29
- 'Tau' => 'τ',
30
- 'Upsilon' => 'υ',
31
- 'Phi' => 'φ',
32
- 'Chi' => 'χ',
33
- 'Psi' => 'ψ',
34
- 'Omega' => 'ω'
35
- }.freeze
36
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greek_abc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Andreev
@@ -72,6 +72,7 @@ files:
72
72
  - greek_abc.gemspec
73
73
  - lib/greek_abc.rb
74
74
  - lib/greek_abc/alphabet.rb
75
+ - lib/greek_abc/constants.rb
75
76
  - lib/greek_abc/letter.rb
76
77
  - lib/greek_abc/version.rb
77
78
  homepage: https://github.com/vladyio/greek_abc