bzsnippets 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,7 @@ module Bzsnippets
30
30
  def all_envs
31
31
  if @options[:source].kind_of? Proc
32
32
  got_by_proc = if @options[:source].arity == 1
33
- @options[:source].call(self)
33
+ @options[:source].call(@options[:self])
34
34
  else
35
35
  @options[:source].call
36
36
  end
@@ -57,7 +57,7 @@ module Bzsnippets
57
57
  opts[:env] ||= lambda{(Rails.env if defined? Rails) || ENV["RAILS_ENV"] || "development"}
58
58
  define_method name do
59
59
  v = instance_variable_get("@#{name}")
60
- instance_variable_set("@#{name}", EnvProxy.new(nil, opts)) unless v
60
+ instance_variable_set("@#{name}", EnvProxy.new(nil, opts.merge(:self => self))) unless v
61
61
  instance_variable_get("@#{name}")
62
62
  end
63
63
  define_method "#{name}=" do |value|
@@ -1,3 +1,3 @@
1
1
  module Bzsnippets
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -10,6 +10,7 @@ describe Bzsnippets::Object do
10
10
  env_attribute :a1, :source => (Pathname.new(__FILE__) + '../../fixtures/config.yml'), :env => lambda{"development"}
11
11
  env_attribute :b, :source => lambda{|i| YAML.load_file(Pathname.new(__FILE__) + '../../fixtures/config.yml')}, :env => lambda{"test"}
12
12
  env_attribute :c, :source => lambda{|i| Pathname.new(__FILE__) + '../../fixtures/config.yml'}, :env => lambda{"test"}
13
+ env_attribute :e, :source => lambda{|i| i.to_s; Pathname.new(__FILE__) + '../../fixtures/config.yml' }
13
14
  end
14
15
  end
15
16
  it "should work" do
@@ -44,4 +45,9 @@ describe Bzsnippets::Object do
44
45
  a.b.should == a.c
45
46
  end
46
47
 
48
+ it "should pass called method object to 1-arity block" do
49
+ a = Tester.new
50
+ a.e.to_s
51
+ end
52
+
47
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bzsnippets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: