letters 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -60,6 +60,7 @@ Here are the methods, listed with any options that can be passed in to modify th
60
60
 
61
61
  - `:message (string)`: Print out the specified message as the method is being called.
62
62
  - `:line_no (boolean)`: Print out the line number where a method is called as it is being called
63
+ - `:disable (boolean)`: Disable this method's side effects
63
64
 
64
65
  You can easily set these for an entire project using global configuration if you wish (see below).
65
66
 
@@ -203,3 +204,11 @@ Letters.config do
203
204
  all :line_no => true
204
205
  end
205
206
  ```
207
+
208
+ To disable all Letters, for example if you're worried about them getting into a production environment:
209
+
210
+ ```ruby
211
+ Letters.config do
212
+ all :disable => true
213
+ end
214
+ ```
@@ -15,11 +15,14 @@ module Letters
15
15
 
16
16
  def ubertap(letter, opts={}, orig_caller=[], &block)
17
17
  full_opts = Letters.defaults_with(letter, opts)
18
- Helpers.message full_opts
19
- Helpers.print_line(orig_caller[0]) if full_opts[:line_no]
20
18
 
21
- tap do |o|
22
- block.call(o, full_opts)
19
+ unless full_opts[:disable]
20
+ Helpers.message full_opts
21
+ Helpers.print_line(orig_caller[0]) if full_opts[:line_no]
22
+
23
+ tap do |o|
24
+ block.call(o, full_opts)
25
+ end
23
26
  end
24
27
  end
25
28
 
@@ -1,3 +1,3 @@
1
1
  module Letters
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -40,6 +40,16 @@ module Letters
40
40
  $stdout.should_receive(:puts).never
41
41
  hash.b
42
42
  end
43
+
44
+ it "allows disabling of all letters" do
45
+ Letters.config do
46
+ all :disable => true
47
+ b :line_no => true
48
+ end
49
+
50
+ $stdout.should_receive(:puts).never
51
+ hash.b
52
+ end
43
53
  end
44
54
 
45
55
  describe ".reset_config!" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: