bruce-banner 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,12 +8,15 @@ puts '*' * 40
8
8
  puts "thing: #{thing}"
9
9
  ```
10
10
 
11
- Since my laziness knows no bounds I created this so I can do this instead:
11
+ Since my laziness knows no bounds I wrote this gem so I can type stuff like this instead:
12
12
 
13
13
  ```ruby
14
14
  bb thing
15
15
  ```
16
16
 
17
+ Also a few other pretty printing/debug gems were a bit overkill...but still very nice ;)
18
+ Even more importantly, it's really all about the name...
19
+
17
20
  ## Usage
18
21
 
19
22
  in irb:
@@ -22,7 +25,7 @@ in irb:
22
25
  require 'bruce-banner'
23
26
 
24
27
  # NOTE: if sticking a Hash directly in the call you may need the parens
25
- bb({one:1, two:2})
28
+ bb({one:1, two:2}) # or h = {one:1, two:2}; bb h
26
29
 
27
30
  # output with the default settings
28
31
  ------------------
@@ -30,7 +33,7 @@ bb({one:1, two:2})
30
33
  ```
31
34
 
32
35
  Even better magic shamelessy stolen from Jim Weirich.
33
- You pass a block with the name of a variable and it will print the name and the value.
36
+ You pass a *block* wrapping the name of a variable *(as a symbol)* and it will print the name and the value.
34
37
 
35
38
  ```ruby
36
39
  magic = "this is voodoo magic!"
@@ -41,12 +44,23 @@ bb {:magic}
41
44
  magic: this is voodoo magic!
42
45
 
43
46
  # NOTE: passing the block overrides any passed in value but will pick up defaults
44
- bb(magic, after:true) {:magic}
47
+ that_whiny_girl_from_highschool = "no one pays any attention to me!"
48
+ bb(that_whiny_girl_from_highschool, after:true) {:magic}
45
49
 
46
50
  # outputs
47
51
  ----------------------------
48
52
  magic: this is voodoo magic!
49
53
  ----------------------------
54
+
55
+ # Really you can just invoke the method like this:
56
+ # forgetting all about that girl from high school
57
+
58
+ bb(after:true) {:magic}
59
+
60
+ # and it sill outputs
61
+ ----------------------------
62
+ magic: this is voodoo magic!
63
+ ----------------------------
50
64
  ```
51
65
 
52
66
  ## Configuration Options
@@ -78,7 +92,7 @@ bb({one:1, two:2}, after:true, string:'*')
78
92
  ## And just for fun!
79
93
 
80
94
  ```ruby
81
- BruceBanner.make_him_angry!
95
+ BruceBanner.make_him_angry! #=> find out for yourself ;)
82
96
  ```
83
97
 
84
98
  ## Installation
@@ -106,3 +120,4 @@ bb("thing", 1432) #=> thing: 1432
106
120
  ```
107
121
 
108
122
 
123
+
@@ -1,3 +1,3 @@
1
1
  module BruceBanner
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/bruce-banner.rb CHANGED
@@ -22,9 +22,9 @@ module BruceBanner
22
22
  output << " | : | | ---:--- | | : | "
23
23
  output << " \\ : | |_____:_____| | : / "
24
24
  output << " / ( |----|------| ) \\ "
25
- output << " /... .| /` | '\\ |. ...\\ "
26
- output << "|::::/'' / .L__. \\ ''\\::::| "
27
- output << " \"\"\"\" / / \\ \\ \"\"\"\" "
25
+ output << " /... .| /` | '\\ |. ...\\ "
26
+ output << "|::::/'' / .L__. \\ ''\\::::| "
27
+ output << " \"\"\"\" / / \\ \\ \"\"\"\" "
28
28
  output << " : / \\ : "
29
29
  output << " | / \\ | "
30
30
  output << " \\ / \\ / "
@@ -59,11 +59,10 @@ module BruceBanner
59
59
  end
60
60
 
61
61
  if options[:size_to_fit]
62
- options[:count] = what.to_s.size
62
+ options[:count] = [what.to_s.size, BruceBanner.defaults[:maximum]].min
63
63
  end
64
64
 
65
65
  puts(options[:string] * options[:count]) if options[:before]
66
- puts "#{what}"
67
66
  puts(options[:string] * options[:count]) if options[:after]
68
67
  end
69
68
 
@@ -89,6 +88,7 @@ module BruceBanner
89
88
  string:'-',
90
89
  before:true,
91
90
  after:false,
92
- size_to_fit:true
91
+ size_to_fit:true,
92
+ maximum: 80
93
93
  }
94
94
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bruce-banner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-21 00:00:00.000000000 Z
12
+ date: 2013-05-24 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: wraps `puts' output with a banner
15
15
  email: