cloudhead-mutter 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -2
- data/VERSION +1 -1
- data/lib/mutter/mutterer.rb +12 -8
- data/mutter.gemspec +2 -2
- metadata +2 -2
data/README.md
CHANGED
@@ -18,13 +18,13 @@ usage (command-line output)
|
|
18
18
|
mut.say "hello world", :bold # bolds the whole string
|
19
19
|
mut.say "hello [world]", :cyan # inverts 'world', and colors the string cyan
|
20
20
|
mut.print "bonjour!" # alias of `say`
|
21
|
-
mut["
|
21
|
+
mut["_hola_"] # return the stylized string without printing
|
22
22
|
|
23
23
|
styles
|
24
24
|
------
|
25
25
|
mutter supports these styles:
|
26
26
|
|
27
|
-
:bold, :underline, :inverse
|
27
|
+
:bold, :underline, :inverse, :blink
|
28
28
|
|
29
29
|
and these colors:
|
30
30
|
|
@@ -53,6 +53,13 @@ customization
|
|
53
53
|
|
54
54
|
mut = Mutter.new :yellow => '~'
|
55
55
|
mut.say "~[black on yellow!]~"
|
56
|
+
|
57
|
+
### add/remove styles from an instance
|
58
|
+
|
59
|
+
mut = Mutter.new(:blink)
|
60
|
+
mut >> :blink # remove :blink
|
61
|
+
mut << :bold << :underline # add :bold and :underline
|
62
|
+
mut.say "hello mutter." # bold and underlined
|
56
63
|
|
57
64
|
### YAML styles
|
58
65
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/mutter/mutterer.rb
CHANGED
@@ -55,17 +55,21 @@ module Mutter
|
|
55
55
|
end
|
56
56
|
|
57
57
|
#
|
58
|
-
# Output to
|
59
|
-
# we parse the string, but also apply a style on the whole string,
|
58
|
+
# Output to @stream
|
60
59
|
#
|
61
|
-
def say
|
62
|
-
|
63
|
-
self.write out.gsub(/\e(\d+)\e/, "\e[\\1m") + "\n"
|
64
|
-
end
|
60
|
+
def say msg, *styles
|
61
|
+
self.write process(msg, *styles) + "\n"
|
65
62
|
end
|
66
|
-
|
63
|
+
|
67
64
|
alias :print say
|
68
|
-
|
65
|
+
|
66
|
+
#
|
67
|
+
# Parse the message, but also apply a style on the whole thing
|
68
|
+
#
|
69
|
+
def process msg, *styles
|
70
|
+
stylize(parse(msg), @active + styles).gsub(/\e(\d+)\e/, "\e[\\1m")
|
71
|
+
end
|
72
|
+
alias :[] process
|
69
73
|
|
70
74
|
#
|
71
75
|
# Write to the out stream, and flush it
|
data/mutter.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{mutter}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["cloudhead"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-03}
|
10
10
|
s.email = %q{self@cloudhead.net}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudhead-mutter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cloudhead
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-03 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|