bzsnippets 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,11 +29,16 @@ module Bzsnippets
29
29
 
30
30
  def all_envs
31
31
  if @options[:source].kind_of? Proc
32
- if @options[:source].arity == 1
32
+ got_by_proc = if @options[:source].arity == 1
33
33
  @options[:source].call(self)
34
34
  else
35
35
  @options[:source].call
36
36
  end
37
+ unless got_by_proc.kind_of? Hash
38
+ @delegate_sd_obj ||= fetch_source(got_by_proc)
39
+ else
40
+ got_by_proc
41
+ end
37
42
  else
38
43
  @delegate_sd_obj ||= fetch_source(@options[:source])
39
44
  end
@@ -1,3 +1,3 @@
1
1
  module Bzsnippets
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -9,6 +9,7 @@ describe Bzsnippets::Object do
9
9
  env_attribute :a, :source => (Pathname.new(__FILE__) + '../../fixtures/config.yml'), :env => lambda{"test"}
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
+ env_attribute :c, :source => lambda{|i| Pathname.new(__FILE__) + '../../fixtures/config.yml'}, :env => lambda{"test"}
12
13
  end
13
14
  end
14
15
  it "should work" do
@@ -38,4 +39,9 @@ describe Bzsnippets::Object do
38
39
  a.b.should == a.a
39
40
  end
40
41
 
42
+ it "should allow source path lambda" do
43
+ a = Tester.new
44
+ a.b.should == a.c
45
+ end
46
+
41
47
  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.6
4
+ version: 0.0.7
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-01-14 00:00:00.000000000 Z
12
+ date: 2013-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport