punctuation_name 1.0.0 → 1.1.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/CHANGELOG.md +8 -0
- data/README.md +21 -7
- data/exe/punctuation_name +2 -4
- data/lib/punctuation_name.rb +27 -19
- data/lib/punctuation_name/dicts/uk.rb +1 -1
- data/lib/punctuation_name/dicts/us.rb +1 -1
- data/lib/punctuation_name/strings.rb +12 -0
- data/lib/punctuation_name/version.rb +2 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e7b2b1922abd3559422a903362c06f5390b31b5d99802fc5a6d1e8ccc27fa24
|
4
|
+
data.tar.gz: e78a647d187a1cd9d722da7839a9dbee60e0ee324472dc20f8d84730ba78e3fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 178f1bd860503e47aaabbffde827ea663eed2c96dfef7de38fc957aa2ea4bc350da97497f29ab96af7679dec215e5416442e74ebb0d5a2bec196313364d914a7
|
7
|
+
data.tar.gz: 3940c99ecdf209376e1e5857c6992ecf2145cd43a0a240758ee5bb52bffb45177c5d7c7c5e67611983f330bacbe56aef61b8c504c0893d1a7a7944ddd9deb846
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 1.1.0 (January 24, 2019)
|
2
|
+
|
3
|
+
IMPROVEMENTS:
|
4
|
+
|
5
|
+
* Move the code inside of a module namespace. ([@TGWolf][])
|
6
|
+
* Extend the strings class so that str.punctuation_name works. ([@TGWolf][])
|
7
|
+
* Update the documentation. ([@TGWolf][])
|
8
|
+
|
1
9
|
## 1.0.0 (January 24, 2019)
|
2
10
|
|
3
11
|
* Initial Release ([@TGWolf][])
|
data/README.md
CHANGED
@@ -33,9 +33,13 @@ Or install it yourself as:
|
|
33
33
|
You can use the default built in dictionary which is UK/English.
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
|
36
|
+
require 'punctuation_name'
|
37
37
|
|
38
|
-
puts
|
38
|
+
puts PunctuationName::Punctuation.name('!')
|
39
|
+
|
40
|
+
# or
|
41
|
+
|
42
|
+
puts '!'.punctuation_name
|
39
43
|
```
|
40
44
|
|
41
45
|
### Extended Usage
|
@@ -43,9 +47,13 @@ You can use the default built in dictionary which is UK/English.
|
|
43
47
|
You can also use the built-in US dictionary.
|
44
48
|
|
45
49
|
```ruby
|
46
|
-
|
50
|
+
require 'punctuation_name'
|
51
|
+
|
52
|
+
puts PunctuationName::Punctuation.name('!', 'us')
|
53
|
+
|
54
|
+
# or
|
47
55
|
|
48
|
-
puts
|
56
|
+
puts '!'.punctuation_name('us')
|
49
57
|
```
|
50
58
|
|
51
59
|
### Advanced Usage
|
@@ -53,9 +61,15 @@ You can also use the built-in US dictionary.
|
|
53
61
|
You can define your own dictionary, the below example just does a single item, but you can make the set as large as you need.
|
54
62
|
|
55
63
|
```
|
56
|
-
|
57
|
-
|
58
|
-
|
64
|
+
require 'punctuation_name'
|
65
|
+
|
66
|
+
PunctuationName::Punctuation.custom('custom', { '!' => 'shouty marker' })
|
67
|
+
|
68
|
+
puts PunctuationName::Punctuation.name('!', 'custom')
|
69
|
+
|
70
|
+
# or
|
71
|
+
|
72
|
+
puts '!'.punctuation_name('custom')
|
59
73
|
```
|
60
74
|
|
61
75
|
## Return Value
|
data/exe/punctuation_name
CHANGED
@@ -10,12 +10,10 @@ require 'punctuation_name'
|
|
10
10
|
# -------------------------------------------------------------------------------- #
|
11
11
|
|
12
12
|
def punctuation_name(options)
|
13
|
-
pn = PunctuationName.new
|
14
|
-
|
15
13
|
if options[:dictionary]
|
16
|
-
puts
|
14
|
+
puts PunctuationName::Punctuation.name(options[:punctuation], options[:dictionary])
|
17
15
|
else
|
18
|
-
puts
|
16
|
+
puts PunctuationName::Punctuation.name(options[:punctuation])
|
19
17
|
end
|
20
18
|
end
|
21
19
|
|
data/lib/punctuation_name.rb
CHANGED
@@ -1,31 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require_relative 'punctuation_name/version'
|
2
|
+
require_relative 'punctuation_name/strings'
|
3
|
+
require_relative 'punctuation_name/dicts/uk.rb'
|
4
|
+
require_relative 'punctuation_name/dicts/us.rb'
|
4
5
|
|
5
6
|
#
|
6
7
|
# Add docs
|
7
8
|
#
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
module PunctuationName
|
10
|
+
#
|
11
|
+
# To go here
|
12
|
+
#
|
13
|
+
class Punctuation
|
14
|
+
$dict = {}
|
11
15
|
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
def self.setup
|
17
|
+
$dict['uk'] = UK_NAMES
|
18
|
+
$dict['us'] = US_NAMES
|
19
|
+
end
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
21
|
+
def self.custom(name, dict)
|
22
|
+
$dict[name] = dict
|
23
|
+
end
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
def self.name_from_dictionary(punctuation, dict)
|
26
|
+
dict.key?(punctuation) ? dict[punctuation] : punctuation
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.name(punctuation, dict_name = 'uk')
|
30
|
+
setup
|
23
31
|
|
24
|
-
|
25
|
-
dict_name = 'uk' if dict_name.empty?
|
32
|
+
dict_name = 'uk' if dict_name.empty?
|
26
33
|
|
27
|
-
|
34
|
+
return punctuation unless $dict.key?(dict_name)
|
28
35
|
|
29
|
-
|
36
|
+
name_from_dictionary(punctuation, $dict[dict_name])
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = '1.
|
1
|
+
module PunctuationName
|
2
|
+
VERSION = '1.1.0'.freeze
|
3
3
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: punctuation_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Gurney aka Wolf
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/punctuation_name.rb
|
79
79
|
- lib/punctuation_name/dicts/uk.rb
|
80
80
|
- lib/punctuation_name/dicts/us.rb
|
81
|
+
- lib/punctuation_name/strings.rb
|
81
82
|
- lib/punctuation_name/version.rb
|
82
83
|
- punctuation_name.gemspec
|
83
84
|
homepage: https://github.com/WolfSoftware/punctuation_name
|