remoji 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/remoji.rb +16 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d5a03e776d9a4c24279a76277ba676d67a6879e2b1abe5d581a6b21f159b18
|
4
|
+
data.tar.gz: b9e4c716805f748ac65a9b434dfb5752e8c9cad36dd4852df8b8693641d39c2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebe90145555111865897b5769ab9102650c5aecc422b74addcc0584213cea92e0a00d59be27d5fb49519d612e44c25c252b76d340b46228fe886e441223220df
|
7
|
+
data.tar.gz: 2d55275638a5fa539719bb08f8d659accfbaf04018d7509481ff52b7e3613943574dfdf861cf8b69b750663f5e5c4f8b8fc2348eadcd4b8d144b67a54d0c0a67
|
data/lib/remoji.rb
CHANGED
@@ -90,6 +90,10 @@ class Remoji # rubocop:disable Metrics/ClassLength
|
|
90
90
|
import_emojis!
|
91
91
|
end
|
92
92
|
|
93
|
+
def filter_array
|
94
|
+
@filter_array ||= filter_hash.to_a
|
95
|
+
end
|
96
|
+
|
93
97
|
def filter_hash
|
94
98
|
return @filter_hash if @filter_hash
|
95
99
|
|
@@ -107,18 +111,22 @@ class Remoji # rubocop:disable Metrics/ClassLength
|
|
107
111
|
parse_opts! args
|
108
112
|
|
109
113
|
if args.empty?
|
110
|
-
output
|
114
|
+
output filter_array
|
111
115
|
exit
|
112
116
|
end
|
113
117
|
|
114
118
|
found = []
|
115
119
|
args.each do |arg|
|
116
|
-
found
|
120
|
+
found += find_in_filter_array(arg)
|
117
121
|
end
|
118
122
|
|
119
123
|
output found
|
120
124
|
end
|
121
125
|
|
126
|
+
def find_in_filter_array(arg)
|
127
|
+
find_in_filter_hash(arg).to_a || []
|
128
|
+
end
|
129
|
+
|
122
130
|
def find_in_filter_hash(arg)
|
123
131
|
filter_hash.select do |k, _v|
|
124
132
|
s = k.to_s
|
@@ -190,19 +198,18 @@ class Remoji # rubocop:disable Metrics/ClassLength
|
|
190
198
|
end
|
191
199
|
|
192
200
|
def output(them) # rubocop:disab
|
193
|
-
die! 'No matching emojis found', 2 if them.
|
201
|
+
die! 'No matching emojis found', 2 if them.empty?
|
194
202
|
|
195
|
-
them.each do |
|
196
|
-
key = k.keys.first
|
197
|
-
v = k[key]
|
203
|
+
them.each do |name, attrs|
|
198
204
|
if @options.no
|
199
|
-
print "#{
|
205
|
+
print "#{attrs[:sym]} "
|
200
206
|
elsif @options.verbose.positive?
|
201
|
-
puts "#{
|
207
|
+
puts "#{name}: #{attrs}"
|
202
208
|
else
|
203
|
-
puts "#{
|
209
|
+
puts "#{name}: #{attrs[:sym]}"
|
204
210
|
end
|
205
211
|
end
|
212
|
+
print "\n" if @options.no
|
206
213
|
end
|
207
214
|
end
|
208
215
|
|