nasty 0.0.1388163823 → 0.0.1388164765

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a2d747b1ab039657b72106eed7dc22577b620cd
4
- data.tar.gz: 1dcf0df9929bdc939d48a44b5adb701ddd8e6efd
3
+ metadata.gz: 995a19f3b4d92203b7f3933b8a7f9ddd9e45b309
4
+ data.tar.gz: d401b56b95c311a714792fa3ff52ca4e020c3d43
5
5
  SHA512:
6
- metadata.gz: 6cac89a27e056642ab1862fcd78609d3d14de84dd1d58ccaf27205f52616a37c451dba5364263f68f324c3c43686fbef0e5e2741b555ee8900dcadb228353408
7
- data.tar.gz: 292f3f11c7e2d0672702dca327ff8428a17bc4fc36764bc7035a96c91e94079f5caa1a1f4e4c128891bc5d039d76f3ff77ad292e176ce632ae73874f6b569aab
6
+ metadata.gz: 16f0eac4ab391be52b8cc1c8c16886f70f4a0ae9e4e527ee5df459f31e86344cd49ff7b00510f929871751384e8cc8d64da101770521dc6f228aee633b0dd7ac
7
+ data.tar.gz: 5206da615cfbc0acec78631d77e242c857d0d24dd58d6b348724c1669a1b26651384000a8ee72f8398a1551a89dc813ac07bf18a7e4b0b0de67145516753241e
@@ -1,6 +1,7 @@
1
1
  require "nasty/background_job"
2
2
  require "nasty/command"
3
3
  require "nasty/composite_command"
4
+ require "nasty/expose_binding"
4
5
  require "nasty/kernel"
5
6
  require "nasty/log"
6
7
  require "nasty/object"
@@ -0,0 +1,7 @@
1
+ module Nasty
2
+ module ExposeBinding
3
+ def get_binder
4
+ binding
5
+ end
6
+ end
7
+ end
@@ -13,6 +13,10 @@ module Nasty
13
13
  end
14
14
  @@log_factory.create_for(target)
15
15
  end
16
+
17
+ def unbind
18
+ remove_class_variable(:@@log_factory)
19
+ end
16
20
  end
17
21
  end
18
22
 
@@ -0,0 +1,16 @@
1
+ require "spec_helper"
2
+
3
+ module Nasty
4
+ describe ExposeBinding do
5
+ it "exposes an objects private binding" do
6
+ item = Object.new
7
+ item.instance_eval do
8
+ @message = "secret"
9
+ end
10
+ item.extend(Nasty::ExposeBinding)
11
+ binding = item.get_binder
12
+ result = ERB.new("<%= @message %>").result(binding)
13
+ result.should == "secret"
14
+ end
15
+ end
16
+ end
@@ -24,6 +24,10 @@ module Nasty
24
24
  Log.for(self).debug("hi there")
25
25
  end
26
26
 
27
+ after :each do
28
+ Log.unbind
29
+ end
30
+
27
31
  it "should log to the bound logger" do
28
32
  logger.should have_received(:debug).with("hi there")
29
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nasty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1388163823
4
+ version: 0.0.1388164765
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
@@ -83,6 +83,7 @@ files:
83
83
  - lib/nasty/background_job.rb
84
84
  - lib/nasty/command.rb
85
85
  - lib/nasty/composite_command.rb
86
+ - lib/nasty/expose_binding.rb
86
87
  - lib/nasty/kernel.rb
87
88
  - lib/nasty/lambda_behaviours.rb
88
89
  - lib/nasty/log.rb
@@ -91,6 +92,7 @@ files:
91
92
  - nasty.gemspec
92
93
  - spec/spec_helper.rb
93
94
  - spec/unit/command_spec.rb
95
+ - spec/unit/expose_binding_spec.rb
94
96
  - spec/unit/lambda_behaviours_spec.rb
95
97
  - spec/unit/log_spec.rb
96
98
  - spec/unit/using_spec.rb
@@ -121,6 +123,7 @@ summary: basicly it's a commons library
121
123
  test_files:
122
124
  - spec/spec_helper.rb
123
125
  - spec/unit/command_spec.rb
126
+ - spec/unit/expose_binding_spec.rb
124
127
  - spec/unit/lambda_behaviours_spec.rb
125
128
  - spec/unit/log_spec.rb
126
129
  - spec/unit/using_spec.rb