mutaconf 0.1.0 → 0.1.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Mutaconf
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
 
6
6
  def self.dsl *args
7
7
  DSL.new *args
@@ -91,9 +91,11 @@ module Mutaconf
91
91
  attr, method = m[1].to_sym, m[0].to_sym
92
92
  if attr
93
93
  raise KeyError, attr unless has?(attr, method) or @lenient
94
- return @attr_targets[attr].get attr if args.empty?
95
- @attr_targets[attr].set attr, args.first if @attr_targets.default or @attr_targets.key?(attr)
96
- @proxy_targets[attr].send *(args.unshift method) if @proxy_targets.default or @proxy_targets.key?(attr)
94
+ if @attr_targets.default or @attr_targets.key?(attr)
95
+ return @attr_targets[attr].get attr if args.empty?
96
+ @attr_targets[attr].set attr, args.first
97
+ end
98
+ @proxy_targets[attr].send *(args.unshift method), &block if @proxy_targets.default or @proxy_targets.key?(attr)
97
99
  else
98
100
  super
99
101
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "mutaconf"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["AlphaHydrae"]
@@ -5,13 +5,16 @@ describe 'DSL proxies' do
5
5
  let(:target){ OpenStruct.new }
6
6
  let(:dsl){ Mutaconf::DSL.new options }
7
7
  let(:options){ { proxy: { target => true } } }
8
+ let(:block){ lambda{} }
8
9
 
9
10
  it "should proxy method calls with instance evaluation" do
10
11
  target.should_receive(:a).with('b')
11
12
  target.should_receive(:c=).with('d')
13
+ target.should_receive(:e).with('f', &block)
12
14
  result = dsl.configure do
13
15
  a 'b'
14
16
  self.c = 'd'
17
+ e 'f', &block
15
18
  end
16
19
  result.should be(dsl)
17
20
  end
@@ -44,10 +47,10 @@ describe 'DSL proxies' do
44
47
  let(:options){ { proxy: { target => [ :a, :e ] }, lenient: true } }
45
48
 
46
49
  it "should configure restricted properties with instance evaluation" do
47
- target.should_receive(:a).with('b')
50
+ target.should_receive(:a).with('b', &block)
48
51
  target.should_receive(:e).with('f')
49
52
  result = dsl.configure do
50
- a 'b'
53
+ a 'b', &block
51
54
  c 'd'
52
55
  e 'f'
53
56
  g 'h'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutaconf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: