figlet 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -0
- data/figlet.gemspec +1 -1
- data/lib/figlet/typesetter.rb +12 -22
- metadata +37 -36
- checksums.yaml +0 -7
data/README.md
CHANGED
data/figlet.gemspec
CHANGED
data/lib/figlet/typesetter.rb
CHANGED
@@ -1,38 +1,28 @@
|
|
1
1
|
module Figlet
|
2
2
|
class Typesetter
|
3
|
-
def initialize(font, options =
|
3
|
+
def initialize(font, options = {})
|
4
4
|
@font = font
|
5
5
|
|
6
|
-
@
|
7
|
-
|
8
|
-
@smush = @options.has_key?(:smush) ? @options[:smush] : true
|
6
|
+
@smush = options.fetch(:smush) { true }
|
9
7
|
end
|
10
8
|
|
11
9
|
def [](str)
|
12
10
|
result = []
|
13
11
|
|
14
|
-
str.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
next
|
22
|
-
end
|
12
|
+
str.bytes.each_with_index do |byte, index|
|
13
|
+
if @font.has_char?(byte)
|
14
|
+
char = @font[byte]
|
15
|
+
elsif @font.has_char?(0)
|
16
|
+
char = @font[0]
|
17
|
+
else
|
18
|
+
next
|
23
19
|
end
|
24
20
|
|
25
21
|
@font.height.times do |j|
|
26
|
-
|
27
|
-
|
28
|
-
if result[j].nil?
|
29
|
-
result[j] = line
|
30
|
-
else
|
31
|
-
result[j] = @font.right_to_left?? (line + result[j]) : (result[j] + line)
|
32
|
-
end
|
22
|
+
result[j] = @font.right_to_left? ? "#{char[j]}#{result[j]}" : "#{result[j]}#{char[j]}"
|
33
23
|
end
|
34
24
|
|
35
|
-
if @font.old_layout > -1 &&
|
25
|
+
if @font.old_layout > -1 && index > 0
|
36
26
|
diff = -1
|
37
27
|
|
38
28
|
@font.height.times do |j|
|
@@ -59,7 +49,7 @@ module Figlet
|
|
59
49
|
end
|
60
50
|
end
|
61
51
|
|
62
|
-
|
52
|
+
result.join("\n").gsub(/\0/, '').gsub(@font.hard_blank, ' ')
|
63
53
|
end
|
64
54
|
|
65
55
|
private
|
metadata
CHANGED
@@ -1,36 +1,39 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: figlet
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Tim Fletcher
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-10-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
19
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
21
21
|
version: 10.0.3
|
22
22
|
type: :development
|
23
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 10.0.3
|
24
30
|
description: Ruby FIGlet library
|
25
|
-
email:
|
31
|
+
email:
|
26
32
|
- mail@tfletcher.com
|
27
33
|
executables: []
|
28
|
-
|
29
34
|
extensions: []
|
30
|
-
|
31
35
|
extra_rdoc_files: []
|
32
|
-
|
33
|
-
files:
|
36
|
+
files:
|
34
37
|
- lib/figlet/font.rb
|
35
38
|
- lib/figlet/smusher.rb
|
36
39
|
- lib/figlet/typesetter.rb
|
@@ -44,29 +47,27 @@ files:
|
|
44
47
|
- figlet.gemspec
|
45
48
|
homepage: http://github.com/tim/figlet
|
46
49
|
licenses: []
|
47
|
-
|
48
|
-
metadata: {}
|
49
|
-
|
50
50
|
post_install_message:
|
51
51
|
rdoc_options: []
|
52
|
-
|
53
|
-
require_paths:
|
52
|
+
require_paths:
|
54
53
|
- lib
|
55
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version:
|
61
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
-
|
63
|
-
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
64
66
|
requirements: []
|
65
|
-
|
66
67
|
rubyforge_project:
|
67
|
-
rubygems_version:
|
68
|
+
rubygems_version: 1.8.23
|
68
69
|
signing_key:
|
69
|
-
specification_version:
|
70
|
+
specification_version: 3
|
70
71
|
summary: See description
|
71
72
|
test_files: []
|
72
|
-
|
73
|
+
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: a788742ddac0cc992c4614ab7f9ff97a40370485
|
4
|
-
data.tar.gz: 510cb33eb0a489eeb232de00a7ca27684bf5be6d
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 9bc46e841c8ecf56ce8ccf09560eacfc7fb6508ae78649018c66680edb308f697c69775f162ae2201d1d9d703a1f58c96fec3aeaa88f60a30fdc47d01eb12fa8
|
7
|
-
data.tar.gz: 4bf95516de8b07cbfff83a90fb0a2963abd22038c52a79d776df1e0dc32323e9eeeb8958fc6537b7fd934910e93886a7cc02131908a5cff1abed2a641e9662d2
|