docile 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b295f680ae1c64b5825a284bea4efbd8ddaa2c5b
4
+ data.tar.gz: d4f19b3d37e262cdbe117c98d40695798c8bfb94
5
+ SHA512:
6
+ metadata.gz: 88e3011f1060083fac18a51a6337fc0f6f8f85f6c87ff45a596a8da35164374a5d815a47d20b76bee791bc346874b77062b702f90bbb81e6a5058049503cbf5a
7
+ data.tar.gz: 6d53a3345ce3f6ed0612cc445bdc338e8f6c3e8e53e405aedf70cfc106c9c56c02377bad6d331147b48e910f8936bcd510846bf1c6ad17a4c8e14f954905662b
@@ -1,2 +1,2 @@
1
- service_name: travis-pro
1
+ service_name: travis-ci
2
2
 
data/HISTORY.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # HISTORY
2
2
 
3
+ ## [v1.0.4 (Jul 25, 2013)](http://github.com/ms-ati/docile/compare/v1.0.3...v1.0.4)
4
+
5
+ - simplify and clarify code
6
+ - fix a minor bug where FallbackContextProxy#instance_variables would return
7
+ symbols rather than strings on Ruby 1.8.x
8
+
3
9
  ## [v1.0.3 (Jul 6, 2013)](http://github.com/ms-ati/docile/compare/v1.0.2...v1.0.3)
4
10
 
5
11
  - instrument code coverage via SimpleCov and publish to Coveralls.io
@@ -22,10 +22,14 @@ module Docile
22
22
  block_context = eval("self", block.binding)
23
23
  proxy_context = FallbackContextProxy.new(dsl, block_context)
24
24
  begin
25
- block_context.instance_variables.each { |ivar| proxy_context.instance_variable_set(ivar, block_context.instance_variable_get(ivar)) }
25
+ block_context.instance_variables.each do |ivar|
26
+ proxy_context.instance_variable_set(ivar, block_context.instance_variable_get(ivar))
27
+ end
26
28
  proxy_context.instance_exec(*args,&block)
27
29
  ensure
28
- block_context.instance_variables.each { |ivar| block_context.instance_variable_set(ivar, proxy_context.instance_variable_get(ivar)) }
30
+ block_context.instance_variables.each do |ivar|
31
+ block_context.instance_variable_set(ivar, proxy_context.instance_variable_get(ivar))
32
+ end
29
33
  end
30
34
  dsl
31
35
  end
@@ -2,16 +2,15 @@ require 'set'
2
2
 
3
3
  module Docile
4
4
  class FallbackContextProxy
5
- NON_PROXIED_METHODS = Set[:object_id, :__send__, :__id__, :==, :equal?, :"!", :"!=", :instance_exec,
6
- :instance_variables, :instance_variable_get, :instance_variable_set,
5
+ NON_PROXIED_METHODS = Set[:__send__, :object_id, :__id__, :==, :equal?,
6
+ :"!", :"!=", :instance_exec, :instance_variables,
7
+ :instance_variable_get, :instance_variable_set,
7
8
  :remove_instance_variable]
8
9
 
9
10
  NON_PROXIED_INSTANCE_VARIABLES = Set[:@__receiver__, :@__fallback__]
10
11
 
11
12
  instance_methods.each do |method|
12
- unless NON_PROXIED_METHODS.include?(method.to_sym)
13
- undef_method(method)
14
- end
13
+ undef_method(method) unless NON_PROXIED_METHODS.include?(method.to_sym)
15
14
  end
16
15
 
17
16
  def initialize(receiver, fallback)
@@ -19,22 +18,15 @@ module Docile
19
18
  @__fallback__ = fallback
20
19
  end
21
20
 
22
- # Special case to allow proxy instance variables
23
21
  def instance_variables
24
- # Ruby 1.8.x returns string names, convert to symbols
25
- super.map(&:to_sym) - NON_PROXIED_INSTANCE_VARIABLES.to_a
22
+ # Ruby 1.8.x returns string names, convert to symbols for compatibility
23
+ super.select { |v| !NON_PROXIED_INSTANCE_VARIABLES.include?(v.to_sym) }
26
24
  end
27
25
 
28
26
  def method_missing(method, *args, &block)
29
- __proxy_method__(method, *args, &block)
30
- end
31
-
32
- def __proxy_method__(method, *args, &block)
33
- begin
34
- @__receiver__.__send__(method.to_sym, *args, &block)
35
- rescue ::NoMethodError => e
36
- @__fallback__.__send__(method.to_sym, *args, &block)
37
- end
27
+ @__receiver__.__send__(method.to_sym, *args, &block)
28
+ rescue ::NoMethodError => e
29
+ @__fallback__.__send__(method.to_sym, *args, &block)
38
30
  end
39
31
  end
40
32
  end
@@ -1,3 +1,3 @@
1
1
  module Docile
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -217,4 +217,18 @@ describe Docile do
217
217
 
218
218
  end
219
219
 
220
+ context "FallbackContextProxy#instance_variables" do
221
+
222
+ it "should preserve the class (String or Symbol) normally returned by current ruby version" do
223
+ @a = 1
224
+ expected_type = instance_variables.first.class
225
+
226
+ fcp = Docile::FallbackContextProxy.new(nil, nil)
227
+ fcp.instance_variable_set(:@foo, "foo")
228
+
229
+ fcp.instance_variables.first.class.should == expected_type
230
+ end
231
+
232
+ end
233
+
220
234
  end
@@ -9,7 +9,9 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
9
9
  SimpleCov::Formatter::HTMLFormatter,
10
10
  Coveralls::SimpleCov::Formatter
11
11
  ]
12
- SimpleCov.start
12
+ SimpleCov.start do
13
+ add_filter "/spec/"
14
+ end
13
15
 
14
16
  test_dir = File.dirname(__FILE__)
15
17
  $LOAD_PATH.unshift test_dir unless $LOAD_PATH.include?(test_dir)
metadata CHANGED
@@ -1,120 +1,107 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: docile
3
- version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 3
10
- version: 1.0.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Marc Siegel
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-07-06 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2013-07-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: rake
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 63
28
- segments:
29
- - 0
30
- - 9
31
- - 2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
32
19
  version: 0.9.2
33
- prerelease: false
34
20
  type: :development
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.2
27
+ - !ruby/object:Gem::Dependency
37
28
  name: rspec
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 35
44
- segments:
45
- - 2
46
- - 11
47
- - 0
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
48
33
  version: 2.11.0
49
- prerelease: false
50
34
  type: :development
51
- requirement: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: yard
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
63
35
  prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.11.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
64
48
  type: :development
65
- requirement: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: redcarpet
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
77
49
  prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: redcarpet
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
78
62
  type: :development
79
- requirement: *id004
80
- - !ruby/object:Gem::Dependency
81
- name: github-markup
82
- version_requirements: &id005 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
- version: "0"
91
63
  prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: github-markup
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
92
76
  type: :development
93
- requirement: *id005
94
- - !ruby/object:Gem::Dependency
95
- name: coveralls
96
- version_requirements: &id006 !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
105
77
  prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: coveralls
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
106
90
  type: :development
107
- requirement: *id006
108
- description: Docile turns any Ruby object into a DSL. Especially useful with the Builder pattern.
109
- email:
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Docile turns any Ruby object into a DSL. Especially useful with the Builder
98
+ pattern.
99
+ email:
110
100
  - msiegel@usainnov.com
111
101
  executables: []
112
-
113
102
  extensions: []
114
-
115
103
  extra_rdoc_files: []
116
-
117
- files:
104
+ files:
118
105
  - .coveralls.yml
119
106
  - .gitignore
120
107
  - .ruby-gemset
@@ -134,38 +121,28 @@ files:
134
121
  - spec/spec_helper.rb
135
122
  homepage: http://ms-ati.github.com/docile/
136
123
  licenses: []
137
-
124
+ metadata: {}
138
125
  post_install_message:
139
126
  rdoc_options: []
140
-
141
- require_paths:
127
+ require_paths:
142
128
  - lib
143
- required_ruby_version: !ruby/object:Gem::Requirement
144
- none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- hash: 3
149
- segments:
150
- - 0
151
- version: "0"
152
- required_rubygems_version: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- hash: 3
158
- segments:
159
- - 0
160
- version: "0"
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
161
139
  requirements: []
162
-
163
140
  rubyforge_project: docile
164
- rubygems_version: 1.8.25
141
+ rubygems_version: 2.0.5
165
142
  signing_key:
166
- specification_version: 3
143
+ specification_version: 4
167
144
  summary: Docile keeps your Ruby DSL's tame and well-behaved
168
- test_files:
145
+ test_files:
169
146
  - spec/docile_spec.rb
170
147
  - spec/spec_helper.rb
171
148
  has_rdoc: