named-parameters 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- data/RELEASENOTES +9 -1
- data/VERSION +1 -1
- data/lib/named-parameters.rb +1 -1
- data/lib/named-parameters/module.rb +28 -10
- data/lib/named-parameters/object.rb +22 -4
- data/named-parameters.gemspec +2 -2
- data/spec/named-parameters_spec.rb +58 -58
- metadata +4 -4
data/RELEASENOTES
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.19 [Dec 11, 2010]
|
2
|
+
- [INTERNAL] Will no longer require "bundler/setup"
|
3
|
+
See: https://github.com/jurisgalang/named-parameters/issues#issue/2
|
4
|
+
- [INTERNAL] Added necessary modifications to support Ruby 1.8.6
|
5
|
+
See: https://github.com/jurisgalang/named-parameters/issues#issue/4
|
6
|
+
- [INTERNAL] Intercept method will no longer pass blocks to intercepted
|
7
|
+
method (temporary)
|
8
|
+
|
9
|
+
0.0.18 [Dec 10, 2010]
|
2
10
|
- [INTERNAL] No longer relies on self.name to determine the current class'
|
3
11
|
name, because singleton method name in Class could also be overriden.
|
4
12
|
See: [Issue #3](https://github.com/jurisgalang/named-parameters/issues#issue/3)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.19
|
data/lib/named-parameters.rb
CHANGED
@@ -217,11 +217,27 @@ module NamedParameters
|
|
217
217
|
def has_named_parameters method, spec, mode = :strict
|
218
218
|
# ensure spec entries are initialized and the proper types
|
219
219
|
[ :required, :optional, :oneof ].each{ |k| spec[k] ||= [] }
|
220
|
-
|
220
|
+
|
221
|
+
# assemble/normalize method spec; the following code should
|
222
|
+
# just be:
|
223
|
+
#
|
224
|
+
# spec = Hash[ spec.map{ |k, v|
|
225
|
+
# v = [ v ] unless v.instance_of? Array
|
226
|
+
# v.map!{ |entry| entry.instance_of?(Array) ? Hash[*entry] : entry }
|
227
|
+
# [ k, v ]
|
228
|
+
# } ]
|
229
|
+
#
|
230
|
+
# but we have to play nice with ruby 1.8.6, so we'll have to be content
|
231
|
+
# with the ugliness for now...
|
232
|
+
pairs = spec.map{ |k, v|
|
221
233
|
v = [ v ] unless v.instance_of? Array
|
222
234
|
v.map!{ |entry| entry.instance_of?(Array) ? Hash[*entry] : entry }
|
223
235
|
[ k, v ]
|
224
|
-
}
|
236
|
+
}
|
237
|
+
spec = { }
|
238
|
+
pairs.each{ |x| spec[x[0]] = x[1] }
|
239
|
+
spec = Hash[ spec ]
|
240
|
+
|
225
241
|
spec[:mode] = mode
|
226
242
|
method_specs[key_for(method)] = spec
|
227
243
|
yield spec if block_given?
|
@@ -238,7 +254,7 @@ module NamedParameters
|
|
238
254
|
#
|
239
255
|
def requires *params, &block
|
240
256
|
[ :'self.new', :initialize ].each do |method|
|
241
|
-
spec = method_specs[key_for
|
257
|
+
spec = method_specs[key_for(method)] || { }
|
242
258
|
spec.merge!(:required => params)
|
243
259
|
has_named_parameters method, spec, :strict, &block
|
244
260
|
end
|
@@ -255,7 +271,7 @@ module NamedParameters
|
|
255
271
|
#
|
256
272
|
def recognizes *params, &block
|
257
273
|
[ :'self.new', :initialize ].each do |method|
|
258
|
-
spec = method_specs[key_for
|
274
|
+
spec = method_specs[key_for(method)] || { }
|
259
275
|
spec.merge!(:optional => params)
|
260
276
|
has_named_parameters method, spec, :strict, &block
|
261
277
|
end
|
@@ -297,10 +313,10 @@ module NamedParameters
|
|
297
313
|
# add instrumentation for class methods
|
298
314
|
def singleton_method_added name # :nodoc:
|
299
315
|
apply_method_spec :"self.#{name}" do
|
300
|
-
method = self.
|
301
|
-
spec = method_specs[key_for
|
316
|
+
method = self.metaclass.instance_method name
|
317
|
+
spec = method_specs[key_for(:"self.#{name}")]
|
302
318
|
owner = "#{self}::"
|
303
|
-
|
319
|
+
metaclass.instance_eval do
|
304
320
|
intercept method, owner, name, spec
|
305
321
|
end
|
306
322
|
end
|
@@ -311,7 +327,7 @@ module NamedParameters
|
|
311
327
|
def method_added name # :nodoc:
|
312
328
|
apply_method_spec name do
|
313
329
|
method = instance_method name
|
314
|
-
spec = method_specs[key_for
|
330
|
+
spec = method_specs[key_for(name)]
|
315
331
|
owner = "#{self}#"
|
316
332
|
intercept method, owner, name, spec
|
317
333
|
end
|
@@ -331,7 +347,8 @@ module NamedParameters
|
|
331
347
|
# insert parameter validation prior to executing the instrumented method
|
332
348
|
def intercept method, owner, name, spec # :nodoc:
|
333
349
|
fullname = "#{owner}#{name}"
|
334
|
-
define_method name do |*args, &block|
|
350
|
+
#define_method name do |*args, &block|
|
351
|
+
define_method name do |*args|
|
335
352
|
# locate the argument representing the named parameters value
|
336
353
|
# for the method invocation
|
337
354
|
params = args.last
|
@@ -352,7 +369,8 @@ module NamedParameters
|
|
352
369
|
# inject the updated argument values for params into the arguments
|
353
370
|
# before actually making method invocation
|
354
371
|
args[args.length - 1] = params
|
355
|
-
method.bind(self).call(*args, &block)
|
372
|
+
#method.bind(self).call(*args, &block)
|
373
|
+
method.bind(self).call(*args)
|
356
374
|
end
|
357
375
|
end
|
358
376
|
|
@@ -1,8 +1,26 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
|
+
# metaclass helpers from _why...
|
3
|
+
#
|
2
4
|
# See: http://www.ruby-forum.com/topic/77046
|
5
|
+
# See: https://github.com/dannytatom/metaid
|
6
|
+
# See: http://dannytatom.github.com/metaid/
|
7
|
+
#
|
3
8
|
class Object
|
4
|
-
|
5
|
-
def eigenclass # :nodoc:
|
9
|
+
def metaclass # :nodoc:
|
6
10
|
class << self; self; end
|
7
|
-
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def meta_eval &block
|
14
|
+
metaclass.instance_eval(&block)
|
15
|
+
end
|
16
|
+
|
17
|
+
# adds methods to a metaclass
|
18
|
+
def meta_def name, &block
|
19
|
+
meta_eval { define_method name, &block }
|
20
|
+
end
|
21
|
+
|
22
|
+
# defines an instance method within a class
|
23
|
+
def class_def name, &block
|
24
|
+
class_eval { define_method name, &block }
|
25
|
+
end
|
8
26
|
end
|
data/named-parameters.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{named-parameters}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.19"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Juris Galang"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-11}
|
13
13
|
s.description = %q{This gem simulates named-parameters in Ruby.
|
14
14
|
It's a complement to the common Ruby idiom of using Hash args to emulate
|
15
15
|
the use of named parameters. }
|
@@ -45,12 +45,12 @@ describe "NamedParameters" do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should allow declaration of has_named_parameters" do
|
48
|
-
Foo.should respond_to
|
48
|
+
Foo.should respond_to(:has_named_parameters)
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should enforce named parameters for constructor" do
|
52
|
-
lambda{ Foo.new }.should raise_error
|
53
|
-
lambda{ Foo.new :w => :w }.should raise_error
|
52
|
+
lambda{ Foo.new }.should raise_error(ArgumentError)
|
53
|
+
lambda{ Foo.new :w => :w }.should raise_error(ArgumentError)
|
54
54
|
lambda{ Foo.new :x => :x }.should_not raise_error
|
55
55
|
lambda{ Foo.new :x => :x, :y => :y }.should_not raise_error
|
56
56
|
lambda{ Foo.new :x => :x, :y => :y, :z => :z }.should_not raise_error
|
@@ -58,11 +58,11 @@ describe "NamedParameters" do
|
|
58
58
|
|
59
59
|
it "should enforce named parameters for instrumented instance methods" do
|
60
60
|
lambda{ @foo = Foo.new :x => :x, :y => :y, :z => :z }.should_not raise_error
|
61
|
-
lambda{ @foo.method_one :x }.should raise_error
|
62
|
-
lambda{ @foo.method_one :x, :y }.should raise_error
|
63
|
-
lambda{ @foo.method_one :x, :y, :x => :x, :y => :y, :z => :z, :w => :w }.should raise_error
|
64
|
-
lambda{ @foo.method_one :x => :x, :y => :y, :z => :z }.should raise_error
|
65
|
-
lambda{ @foo.method_one :x, :y, :w => :w }.should raise_error
|
61
|
+
lambda{ @foo.method_one :x }.should raise_error(ArgumentError)
|
62
|
+
lambda{ @foo.method_one :x, :y }.should raise_error(ArgumentError)
|
63
|
+
lambda{ @foo.method_one :x, :y, :x => :x, :y => :y, :z => :z, :w => :w }.should raise_error(ArgumentError)
|
64
|
+
lambda{ @foo.method_one :x => :x, :y => :y, :z => :z }.should raise_error(ArgumentError)
|
65
|
+
lambda{ @foo.method_one :x, :y, :w => :w }.should raise_error(ArgumentError)
|
66
66
|
lambda{ @foo.method_one :x, :y, :x => :x }.should_not raise_error
|
67
67
|
lambda{ @foo.method_one :x, :y, :x => :x, :y => :y }.should_not raise_error
|
68
68
|
lambda{ @foo.method_one :x, :y, :x => :x, :y => :y, :z => :z }.should_not raise_error
|
@@ -70,73 +70,73 @@ describe "NamedParameters" do
|
|
70
70
|
|
71
71
|
it "should not enforce named parameters for un-instrumented instance methods" do
|
72
72
|
lambda{ @foo = Foo.new :x => :x, :y => :y, :z => :z }.should_not raise_error
|
73
|
-
lambda{ @foo.method_two :x }.should raise_error
|
74
|
-
lambda{ @foo.method_two :x, :y }.should_not raise_error
|
75
|
-
lambda{ @foo.method_two :x, :y, :w => :w }.should_not raise_error
|
73
|
+
lambda{ @foo.method_two :x }.should raise_error(ArgumentError)
|
74
|
+
lambda{ @foo.method_two :x, :y }.should_not raise_error(ArgumentError)
|
75
|
+
lambda{ @foo.method_two :x, :y, :w => :w }.should_not raise_error(ArgumentError)
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should enforce named parameters for instrumented class methods" do
|
79
|
-
lambda{ Foo.method_three :x }.should raise_error
|
80
|
-
lambda{ Foo.method_three :x, :y }.should raise_error
|
81
|
-
lambda{ Foo.method_three :x, :y, :x => :x, :y => :y, :z => :z, :w => :w }.should raise_error
|
82
|
-
lambda{ Foo.method_three :x => :x, :y => :y, :z => :z }.should raise_error
|
83
|
-
lambda{ Foo.method_three :x, :y, :w => :w }.should raise_error
|
79
|
+
lambda{ Foo.method_three :x }.should raise_error(ArgumentError)
|
80
|
+
lambda{ Foo.method_three :x, :y }.should raise_error(ArgumentError)
|
81
|
+
lambda{ Foo.method_three :x, :y, :x => :x, :y => :y, :z => :z, :w => :w }.should raise_error(ArgumentError)
|
82
|
+
lambda{ Foo.method_three :x => :x, :y => :y, :z => :z }.should raise_error(ArgumentError)
|
83
|
+
lambda{ Foo.method_three :x, :y, :w => :w }.should raise_error(ArgumentError)
|
84
84
|
lambda{ Foo.method_three :x, :y, :x => :x }.should_not raise_error
|
85
85
|
lambda{ Foo.method_three :x, :y, :x => :x, :y => :y }.should_not raise_error
|
86
86
|
lambda{ Foo.method_three :x, :y, :x => :x, :y => :y, :z => :z }.should_not raise_error
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should not enforce named parameters for un-instrumented class methods" do
|
90
|
-
lambda{ Foo.method_four :x }.should raise_error
|
91
|
-
lambda{ Foo.method_four :x, :y }.should_not raise_error
|
92
|
-
lambda{ Foo.method_four :x, :y, :w => :w }.should_not raise_error
|
90
|
+
lambda{ Foo.method_four :x }.should raise_error(ArgumentError)
|
91
|
+
lambda{ Foo.method_four :x, :y }.should_not raise_error(ArgumentError)
|
92
|
+
lambda{ Foo.method_four :x, :y, :w => :w }.should_not raise_error(ArgumentError)
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should require all :required parameters" do
|
96
96
|
bar = Bar.new
|
97
|
-
lambda{ bar.method_with_one_required }.should raise_error
|
98
|
-
lambda{ bar.method_with_one_required :a => :a }.should raise_error
|
97
|
+
lambda{ bar.method_with_one_required }.should raise_error(ArgumentError)
|
98
|
+
lambda{ bar.method_with_one_required :a => :a }.should raise_error(ArgumentError)
|
99
99
|
lambda{ bar.method_with_one_required :x => :x }.should_not raise_error
|
100
100
|
|
101
|
-
lambda{ bar.method_with_many_required }.should raise_error
|
102
|
-
lambda{ bar.method_with_many_required :x => :x }.should raise_error
|
101
|
+
lambda{ bar.method_with_many_required }.should raise_error(ArgumentError)
|
102
|
+
lambda{ bar.method_with_many_required :x => :x }.should raise_error(ArgumentError)
|
103
103
|
lambda{ bar.method_with_many_required :x => :x, :y => :y }.should_not raise_error
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should require one and only one of :oneof parameters" do
|
107
107
|
bar = Bar.new
|
108
|
-
lambda{ bar.method_with_one_oneof }.should raise_error
|
109
|
-
lambda{ bar.method_with_one_oneof :a => :a }.should raise_error
|
108
|
+
lambda{ bar.method_with_one_oneof }.should raise_error(ArgumentError)
|
109
|
+
lambda{ bar.method_with_one_oneof :a => :a }.should raise_error(ArgumentError)
|
110
110
|
lambda{ bar.method_with_one_oneof :x => :x }.should_not raise_error
|
111
111
|
|
112
|
-
lambda{ bar.method_with_many_oneof }.should raise_error
|
113
|
-
lambda{ bar.method_with_many_oneof :a => :a }.should raise_error
|
112
|
+
lambda{ bar.method_with_many_oneof }.should raise_error(ArgumentError)
|
113
|
+
lambda{ bar.method_with_many_oneof :a => :a }.should raise_error(ArgumentError)
|
114
114
|
lambda{ bar.method_with_many_oneof :x => :x }.should_not raise_error
|
115
115
|
lambda{ bar.method_with_many_oneof :y => :y }.should_not raise_error
|
116
|
-
lambda{ bar.method_with_many_oneof :x => :x, :y => :y }.should raise_error
|
116
|
+
lambda{ bar.method_with_many_oneof :x => :x, :y => :y }.should raise_error(ArgumentError)
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should reject parameters not declared in :required, :optional, or :oneof" do
|
120
120
|
bar = Bar.new
|
121
121
|
lambda{ bar.method_with_one_optional }.should_not raise_error
|
122
122
|
lambda{ bar.method_with_one_optional :x => :x }.should_not raise_error
|
123
|
-
lambda{ bar.method_with_one_optional :a => :a }.should raise_error
|
124
|
-
lambda{ bar.method_with_one_optional :x => :x, :y => :y }.should raise_error
|
123
|
+
lambda{ bar.method_with_one_optional :a => :a }.should raise_error(ArgumentError)
|
124
|
+
lambda{ bar.method_with_one_optional :x => :x, :y => :y }.should raise_error(ArgumentError)
|
125
125
|
|
126
126
|
lambda{ bar.method_with_many_optional }.should_not raise_error
|
127
127
|
lambda{ bar.method_with_many_optional :x => :x }.should_not raise_error
|
128
128
|
lambda{ bar.method_with_many_optional :y => :y }.should_not raise_error
|
129
129
|
lambda{ bar.method_with_many_optional :x => :x, :y => :y }.should_not raise_error
|
130
|
-
lambda{ bar.method_with_many_optional :x => :x, :y => :y, :z => :z }.should raise_error
|
130
|
+
lambda{ bar.method_with_many_optional :x => :x, :y => :y, :z => :z }.should raise_error(ArgumentError)
|
131
131
|
|
132
|
-
lambda{ bar.method_with_one_of_each_requirement }.should raise_error
|
133
|
-
lambda{ bar.method_with_one_of_each_requirement :w => :w }.should raise_error
|
132
|
+
lambda{ bar.method_with_one_of_each_requirement }.should raise_error(ArgumentError)
|
133
|
+
lambda{ bar.method_with_one_of_each_requirement :w => :w }.should raise_error(ArgumentError)
|
134
134
|
lambda{ bar.method_with_one_of_each_requirement :w => :w, :x => :x }.should_not raise_error
|
135
135
|
lambda{ bar.method_with_one_of_each_requirement :w => :w, :y => :y }.should_not raise_error
|
136
|
-
lambda{ bar.method_with_one_of_each_requirement :w => :w, :x => :x, :y => :y }.should raise_error
|
136
|
+
lambda{ bar.method_with_one_of_each_requirement :w => :w, :x => :x, :y => :y }.should raise_error(ArgumentError)
|
137
137
|
lambda{ bar.method_with_one_of_each_requirement :w => :w, :x => :x, :z => :z }.should_not raise_error
|
138
138
|
lambda{ bar.method_with_one_of_each_requirement :w => :w, :y => :y, :z => :z }.should_not raise_error
|
139
|
-
lambda{ bar.method_with_one_of_each_requirement :w => :w, :x => :x, :z => :z, :a => :a }.should raise_error
|
139
|
+
lambda{ bar.method_with_one_of_each_requirement :w => :w, :x => :x, :z => :z, :a => :a }.should raise_error(ArgumentError)
|
140
140
|
end
|
141
141
|
|
142
142
|
it "should be able to supply the default values for optional parameters" do
|
@@ -152,16 +152,16 @@ describe "NamedParameters" do
|
|
152
152
|
end
|
153
153
|
|
154
154
|
zoo = Zoo.new
|
155
|
-
zoo.method_with_one_optional_parameter.should eql
|
156
|
-
zoo.method_with_one_optional_parameter(:x => 2).should eql
|
155
|
+
zoo.method_with_one_optional_parameter.should eql(1)
|
156
|
+
zoo.method_with_one_optional_parameter(:x => 2).should eql(2)
|
157
157
|
|
158
|
-
zoo.method_with_many_optional_parameters.should eql
|
159
|
-
zoo.method_with_many_optional_parameters(:x => 2).should eql
|
160
|
-
zoo.method_with_many_optional_parameters(:x => 2, :y => 3).should eql
|
158
|
+
zoo.method_with_many_optional_parameters.should eql(3)
|
159
|
+
zoo.method_with_many_optional_parameters(:x => 2).should eql(4)
|
160
|
+
zoo.method_with_many_optional_parameters(:x => 2, :y => 3).should eql(5)
|
161
161
|
|
162
|
-
zoo.method_with_many_optional_parameters_too.should eql
|
163
|
-
zoo.method_with_many_optional_parameters_too(:x => 2).should eql
|
164
|
-
zoo.method_with_many_optional_parameters_too(:x => 2, :y => 3).should eql
|
162
|
+
zoo.method_with_many_optional_parameters_too.should eql(3)
|
163
|
+
zoo.method_with_many_optional_parameters_too(:x => 2).should eql(4)
|
164
|
+
zoo.method_with_many_optional_parameters_too(:x => 2, :y => 3).should eql(5)
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should be able to instrument the class method new" do
|
@@ -172,9 +172,9 @@ describe "NamedParameters" do
|
|
172
172
|
end
|
173
173
|
def initialize opts = { }; end
|
174
174
|
end
|
175
|
-
lambda { Quux.new }.should raise_error
|
176
|
-
lambda { Quux.new :y => :y }.should raise_error
|
177
|
-
lambda { Quux.new :x => :x, :y => :y }.should raise_error
|
175
|
+
lambda { Quux.new }.should raise_error(ArgumentError)
|
176
|
+
lambda { Quux.new :y => :y }.should raise_error(ArgumentError)
|
177
|
+
lambda { Quux.new :x => :x, :y => :y }.should raise_error(ArgumentError)
|
178
178
|
lambda { Quux.new :x => :x }.should_not raise_error
|
179
179
|
end
|
180
180
|
|
@@ -188,7 +188,7 @@ describe "NamedParameters" do
|
|
188
188
|
lambda { Recognizes.new :x => :x }.should_not raise_error
|
189
189
|
lambda { Recognizes.new :y => :y }.should_not raise_error
|
190
190
|
lambda { Recognizes.new :x => :x, :y => :y }.should_not raise_error
|
191
|
-
lambda { Recognizes.new :z => :z }.should raise_error
|
191
|
+
lambda { Recognizes.new :z => :z }.should raise_error(ArgumentError)
|
192
192
|
end
|
193
193
|
|
194
194
|
it "should be able to specify required parameters using the recognizes method" do
|
@@ -197,9 +197,9 @@ describe "NamedParameters" do
|
|
197
197
|
def self.new opts = { }; end
|
198
198
|
def initialize opts = { }; end
|
199
199
|
end
|
200
|
-
lambda { Required.new }.should raise_error
|
201
|
-
lambda { Required.new :x => :x }.should raise_error
|
202
|
-
lambda { Required.new :y => :y }.should raise_error
|
200
|
+
lambda { Required.new }.should raise_error(ArgumentError)
|
201
|
+
lambda { Required.new :x => :x }.should raise_error(ArgumentError)
|
202
|
+
lambda { Required.new :y => :y }.should raise_error(ArgumentError)
|
203
203
|
lambda { Required.new :x => :x, :y => :y }.should_not raise_error
|
204
204
|
end
|
205
205
|
|
@@ -223,8 +223,8 @@ describe "NamedParameters" do
|
|
223
223
|
end
|
224
224
|
|
225
225
|
o = DeclaredParameters.new(:x => :x, :y => :y)
|
226
|
-
o.parameters.should eql
|
227
|
-
DeclaredParameters.singleton(:w => :w, :a => :a).should eql
|
226
|
+
o.parameters.should eql([ :a, :b, :c, :x, :y ])
|
227
|
+
DeclaredParameters.singleton(:w => :w, :a => :a).should eql([ :a, :b, :c, :w, :x, :y, :z ])
|
228
228
|
end
|
229
229
|
|
230
230
|
it "should not return nil when declared_parameters is called on uninstrumented method" do
|
@@ -243,8 +243,8 @@ describe "NamedParameters" do
|
|
243
243
|
end
|
244
244
|
|
245
245
|
o = DeclaredParameters.new(:x => :x, :y => :y)
|
246
|
-
o.boogey.should eql
|
247
|
-
DeclaredParameters.boogey(:w => :w, :a => :a).should eql
|
246
|
+
o.boogey.should eql([])
|
247
|
+
DeclaredParameters.boogey(:w => :w, :a => :a).should eql([ :a, :b, :c, :w, :x, :y, :z ])
|
248
248
|
end
|
249
249
|
|
250
250
|
it "should be able to get the list of declared parameters for specified methods" do
|
@@ -282,9 +282,9 @@ describe "NamedParameters" do
|
|
282
282
|
end
|
283
283
|
end
|
284
284
|
o = DeclaredParameters.new(:x => 1, :y => 1)
|
285
|
-
DeclaredParameters.singleton_method_parameters.should eql
|
286
|
-
DeclaredParameters.instance_method_parameters.should eql
|
287
|
-
o.instance_method_parameters.should eql
|
288
|
-
o.singleton_method_parameters.should eql
|
285
|
+
DeclaredParameters.singleton_method_parameters.should eql([ :a, :b, :c, :w, :x, :y, :z ])
|
286
|
+
DeclaredParameters.instance_method_parameters.should eql([ :a, :b, :c, :w, :x, :y, :z ])
|
287
|
+
o.instance_method_parameters.should eql([ :a, :b, :c, :w, :x, :y, :z ])
|
288
|
+
o.singleton_method_parameters.should eql([ :a, :b, :c, :w, :x, :y, :z ])
|
289
289
|
end
|
290
290
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 19
|
9
|
+
version: 0.0.19
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Juris Galang
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-11 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
hash:
|
131
|
+
hash: 2045388278523135009
|
132
132
|
segments:
|
133
133
|
- 0
|
134
134
|
version: "0"
|