ruby_figlet 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +12 -11
- data/lib/figlet_interpreter.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b029b1a636cebee4b50ec4cc7aae07817f6aa474
|
4
|
+
data.tar.gz: 63126bc7878d1f3fb5c0c7b30f84debea0e0ac7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f79bd8e2b7b7238c33a5b7190c1cbcfa59ee66f1a0941e9029bf8eac20964c2de7962947d810019cb64637936f15c8ca226909fc6cfbc76f53fe234529fbb73a
|
7
|
+
data.tar.gz: 75a5903063923d317a9bbe1922893045b45a4d6975fa6f9f02ad427748aed1ef06b1bb0a347d0cee2cbc2f3bef13fe8751d4d419a3fcdc2bb44351d51f1c0292
|
data/README.md
CHANGED
@@ -18,11 +18,12 @@ moo = "Moo!"
|
|
18
18
|
moo.art!
|
19
19
|
puts moo # Default font is 'standard' when no arguments given
|
20
20
|
# =>
|
21
|
-
# __ __
|
22
|
-
# | \/ |
|
23
|
-
# | |\/| |
|
24
|
-
# | | |
|
25
|
-
# |_| |_|
|
21
|
+
# __ __ _
|
22
|
+
# | \/ | ___ ___ | |
|
23
|
+
# | |\/| | / _ \ / _ \ | |
|
24
|
+
# | | | || (_) || (_) ||_|
|
25
|
+
# |_| |_| \___/ \___/ (_)
|
26
|
+
|
26
27
|
|
27
28
|
# or just
|
28
29
|
|
@@ -36,12 +37,12 @@ puts "every base is base *10*".art 'hex' # => 65 76 65 72 79 62 61 73 65 69 73
|
|
36
37
|
|
37
38
|
# German support:
|
38
39
|
puts "Heizölrückstoßabdämpfung".art # =>
|
39
|
-
# _ _
|
40
|
-
# | | | |
|
41
|
-
# | |_| |
|
42
|
-
# | _
|
43
|
-
# |_| |_|
|
44
|
-
#
|
40
|
+
# _ _ _ _ _ _ _ _ _ _ ___ _ _ _ _ __
|
41
|
+
# | | | | ___ (_) ____(_)_(_)| | _ __ (_) (_) ___ | | __ ___ | |_ ___ / _ \ __ _ | |__ __| |(_)_(_) _ __ ___ _ __ / _| _ _ _ __ __ _
|
42
|
+
# | |_| | / _ \| ||_ / / _ \ | || '__|| | | | / __|| |/ // __|| __| / _ \ | |/ / / _` || '_ \ / _` | / _` || '_ ` _ \ | '_ \ | |_ | | | || '_ \ / _` |
|
43
|
+
# | _ || __/| | / / | (_) || || | | |_| || (__ | < \__ \| |_ | (_) || |\ \| (_| || |_) || (_| || (_| || | | | | || |_) || _|| |_| || | | || (_| |
|
44
|
+
# |_| |_| \___||_|/___| \___/ |_||_| \__,_| \___||_|\_\|___/ \__| \___/ | ||_/ \__,_||_.__/ \__,_| \__,_||_| |_| |_|| .__/ |_| \__,_||_| |_| \__, |
|
45
|
+
# |_| |_| |___/
|
45
46
|
|
46
47
|
puts RubyFiglet::Figlet.new("It's an abstract sort of font", 'weird')
|
47
48
|
|
data/lib/figlet_interpreter.rb
CHANGED
@@ -82,19 +82,19 @@ module FigFont
|
|
82
82
|
lines.slice! 0..@height - 1
|
83
83
|
end
|
84
84
|
|
85
|
-
smush! char_hash
|
85
|
+
smush! char_hash unless @old_lay == -1
|
86
86
|
char_hash.each do |key, arr|
|
87
87
|
(0..@height - 1).each { |i| char_hash[key][i] = arr[i].gsub(@hardblank, " ") }
|
88
88
|
end
|
89
89
|
return char_hash
|
90
90
|
end
|
91
91
|
|
92
|
-
private def smush hash
|
92
|
+
private def smush hash
|
93
93
|
hash.each do |letter, letter_arr|
|
94
|
-
(0..
|
94
|
+
(0..letter_arr.min_by(&:length).length - 1).each do |over| # from 0 to the length of the shortest line in the array
|
95
95
|
same_at_index = Array.new(@height - 1, false)
|
96
96
|
(0..@height - 2).each do |down|
|
97
|
-
same_at_index[down] = true if (letter_arr[
|
97
|
+
same_at_index[down] = true if (letter_arr[down][over] == letter_arr[down + 1][over]) && (letter_arr[down][over] == ' ' && letter_arr[down + 1][over] == ' ')
|
98
98
|
end
|
99
99
|
if same_at_index.all?
|
100
100
|
(0..@height - 1).each do |down|
|
@@ -106,8 +106,8 @@ module FigFont
|
|
106
106
|
hash
|
107
107
|
end
|
108
108
|
|
109
|
-
private def smush! hash
|
110
|
-
hash.replace smush hash
|
109
|
+
private def smush! hash
|
110
|
+
hash.replace smush hash
|
111
111
|
end
|
112
112
|
|
113
113
|
def font_data
|