greek_abc 0.3.0 → 0.4.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +32 -2
- data/lib/greek_abc/alphabet.rb +7 -0
- data/lib/greek_abc/constants.rb +0 -1
- data/lib/greek_abc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a86da8d0eaef95512cca7486a252369244b6e3d61dbe6e901306800411676e6
|
4
|
+
data.tar.gz: 073e0baa4c1b43fa4a37bf0c127cc5f81c063714e14b40206602ff497ff07de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a376468ffcc76f5b0be2a2a08709ef93d7ca6e539c1084031dc4a4363bfdb5ac9d88aec5aa6eb1ba6c84f87dd03d399b886c812fd8bbc4d4e514141a060db4e0
|
7
|
+
data.tar.gz: d3f07475cfdd3b7c4b7b3560332fd6d088a83369f3258d55c98da16265b4c5dd9a6e7e070b70f0a23b377ac49da6cb0c8495a3ed71b25c4734f50a88cbe1674d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -22,9 +22,19 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
+
Add `require 'greek_abc'` to your script.
|
26
|
+
|
27
|
+
#### Single letters
|
28
|
+
|
25
29
|
```ruby
|
26
|
-
|
30
|
+
GreekABC::Alphabet.alpha # => #<GreekABC::Letter:0x0000557ef0e4fda8 @position=1, @name="Alpha", @lower="α", @upper="Α">
|
31
|
+
|
32
|
+
GreekABC::Alphabet.omega # => #<GreekABC::Letter:0x0000557ef0e37a78 @position=24, @name="Omega", @lower="ω", @upper="Ω">
|
33
|
+
```
|
34
|
+
|
35
|
+
#### Lookup
|
27
36
|
|
37
|
+
```ruby
|
28
38
|
abc = GreekABC::Alphabet.new
|
29
39
|
|
30
40
|
psi = abc.find_letter_by(name: 'Psi') # => <..@lower="ψ", @name="Psi", @position=23, @upper="Ψ">
|
@@ -59,12 +69,32 @@ abc = GreekABC::Alphabet.new
|
|
59
69
|
puts abc.to_h # => {"Alpha"=>{:position=>1, :lower=>"α", :upper=>"Α"}
|
60
70
|
```
|
61
71
|
|
62
|
-
|
72
|
+
#### Basic sets of letters
|
73
|
+
|
74
|
+
- Hash with letters and their names
|
63
75
|
|
64
76
|
```ruby
|
65
77
|
abc = GreekABC::ALPHABET # => {"Alpha"=>"α", "Beta"=>"β", ...}
|
66
78
|
```
|
67
79
|
|
80
|
+
- Lowercase letters
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
abc = GreekABC::LOWERS # => ["α", "β", ...]
|
84
|
+
```
|
85
|
+
|
86
|
+
- Uppercase letters
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
abc = GreekABC::UPPERS # => ["Α", "Β", ...]
|
90
|
+
```
|
91
|
+
|
92
|
+
- Lowercase and uppercase together
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
abc = GreekABC::LOWERS_AND_UPPERS
|
96
|
+
```
|
97
|
+
|
68
98
|
## Development
|
69
99
|
|
70
100
|
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.
|
data/lib/greek_abc/alphabet.rb
CHANGED
@@ -2,6 +2,13 @@ module GreekABC
|
|
2
2
|
class Alphabet
|
3
3
|
attr_accessor :letters
|
4
4
|
|
5
|
+
ALPHABET.map.with_index(1) do |(name, letter), index|
|
6
|
+
define_singleton_method(:"#{name.downcase}") do
|
7
|
+
Letter.new(position: index, name: name, lower: letter,
|
8
|
+
upper: letter.upcase)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
5
12
|
def initialize
|
6
13
|
@letters = ALPHABET.map.with_index(1) do |(name, letter), index|
|
7
14
|
Letter.new(position: index, name: name, lower: letter,
|
data/lib/greek_abc/constants.rb
CHANGED
data/lib/greek_abc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greek_abc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Andreev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|