formatador 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/formatador.gemspec +2 -2
- data/lib/formatador.rb +9 -3
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/formatador.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{formatador}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wesley Beary"]
|
12
|
-
s.date = %q{2009-12-
|
12
|
+
s.date = %q{2009-12-04}
|
13
13
|
s.description = %q{STDOUT text formatting}
|
14
14
|
s.email = %q{wbeary@engineyard.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/formatador.rb
CHANGED
@@ -55,11 +55,12 @@ class Formatador
|
|
55
55
|
@indent = 1
|
56
56
|
end
|
57
57
|
|
58
|
-
def display(string)
|
58
|
+
def display(string = '')
|
59
59
|
print(format("[indent]#{string}"))
|
60
|
+
STDOUT.flush
|
60
61
|
end
|
61
62
|
|
62
|
-
def display_line(string)
|
63
|
+
def display_line(string = '')
|
63
64
|
display(string)
|
64
65
|
print("\n")
|
65
66
|
end
|
@@ -68,7 +69,7 @@ class Formatador
|
|
68
69
|
if STDOUT.tty?
|
69
70
|
string.gsub(FORMAT_REGEX) { "\e[#{STYLES[$1.to_sym]}m" }.gsub(INDENT_REGEX) { indentation }
|
70
71
|
else
|
71
|
-
string
|
72
|
+
string.gsub(INDENT_REGEX) { indentation }
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
@@ -82,4 +83,9 @@ class Formatador
|
|
82
83
|
' ' * @indent
|
83
84
|
end
|
84
85
|
|
86
|
+
def redisplay(string = '')
|
87
|
+
print("\r")
|
88
|
+
display("#{string}")
|
89
|
+
end
|
90
|
+
|
85
91
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formatador
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wesley Beary
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-04 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|