named-parameters 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/{spec/spec.opts → .rspec} +0 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +30 -0
- data/RELEASENOTES +9 -0
- data/Rakefile +32 -34
- data/VERSION +1 -1
- data/lib/named-parameters.rb +4 -2
- data/lib/named-parameters/module.rb +72 -37
- data/lib/named-parameters/object.rb +1 -0
- data/named-parameters.gemspec +20 -8
- data/spec/named-parameters_spec.rb +41 -0
- data/spec/spec_helper.rb +7 -4
- metadata +67 -18
data/{spec/spec.opts → .rspec}
RENAMED
File without changes
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.5.1)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.8.7)
|
11
|
+
rcov (0.9.9)
|
12
|
+
rspec (2.1.0)
|
13
|
+
rspec-core (~> 2.1.0)
|
14
|
+
rspec-expectations (~> 2.1.0)
|
15
|
+
rspec-mocks (~> 2.1.0)
|
16
|
+
rspec-core (2.1.0)
|
17
|
+
rspec-expectations (2.1.0)
|
18
|
+
diff-lcs (~> 1.1.2)
|
19
|
+
rspec-mocks (2.1.0)
|
20
|
+
yard (0.6.3)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
bundler (~> 1.0.0)
|
27
|
+
jeweler (~> 1.5.1)
|
28
|
+
rcov
|
29
|
+
rspec (~> 2.1.0)
|
30
|
+
yard
|
data/RELEASENOTES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
0.0.15 [Dec 5, 2010]
|
2
|
+
- [BUGFIX] declared_parameters_for usage is now consistent under instance and
|
3
|
+
singleton context.
|
4
|
+
- [INTERNAL] Elevated visibility for declared_parameters,
|
5
|
+
declared_parameters_for, and filter_parameters to public.
|
6
|
+
- [INTERNAL] Added optional processing of block to has_named_parameters and
|
7
|
+
its ilk.
|
8
|
+
- [INTERNAL] Tests added.
|
9
|
+
|
1
10
|
0.0.14 [Nov 29, 2010]
|
2
11
|
- [FEATURE] Added declared_parameters_for method.
|
3
12
|
- [FEATURE] You can now limit/filter the list of declared parameters based on
|
data/Rakefile
CHANGED
@@ -1,47 +1,45 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
2
10
|
require 'rake'
|
3
11
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rescue LoadError
|
21
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "named-parameters"
|
16
|
+
gem.summary = %Q{Poor man's named-parameters in Ruby}
|
17
|
+
gem.description = %Q{This gem simulates named-parameters in Ruby.
|
18
|
+
It's a complement to the common Ruby idiom of using Hash args to emulate
|
19
|
+
the use of named parameters. }
|
20
|
+
gem.email = "jurisgalang@gmail.com"
|
21
|
+
gem.homepage = "http://github.com/jurisgalang/named-parameters"
|
22
|
+
gem.authors = ["Juris Galang"]
|
23
|
+
gem.license = ["MIT", "GPL"]
|
24
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
25
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
26
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
27
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
22
28
|
end
|
29
|
+
Jeweler::RubygemsDotOrgTasks.new
|
23
30
|
|
24
|
-
require '
|
25
|
-
|
26
|
-
|
27
|
-
spec.
|
31
|
+
require 'rspec/core'
|
32
|
+
require 'rspec/core/rake_task'
|
33
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
34
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
28
35
|
end
|
29
36
|
|
30
|
-
|
31
|
-
spec.libs << 'lib' << 'spec'
|
37
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
32
38
|
spec.pattern = 'spec/**/*_spec.rb'
|
33
39
|
spec.rcov = true
|
34
40
|
end
|
35
41
|
|
36
|
-
task :spec => :check_dependencies
|
37
|
-
|
38
42
|
task :default => :spec
|
39
43
|
|
40
|
-
|
41
|
-
|
42
|
-
YARD::Rake::YardocTask.new
|
43
|
-
rescue LoadError
|
44
|
-
task :yardoc do
|
45
|
-
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
46
|
-
end
|
47
|
-
end
|
44
|
+
require 'yard'
|
45
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.15
|
data/lib/named-parameters.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
|
+
|
2
4
|
require 'named-parameters/module'
|
3
5
|
|
4
6
|
# Extend object to automatically make it available for all
|
5
7
|
# user defined classes...
|
6
|
-
class Object
|
8
|
+
class Object
|
7
9
|
include NamedParameters
|
8
10
|
end
|
@@ -21,39 +21,68 @@
|
|
21
21
|
# @author Juris Galang
|
22
22
|
# @copyright 2010 Juris Galang. All Rights Reserved
|
23
23
|
#
|
24
|
-
|
25
|
-
protected
|
26
|
-
def self.included base # :nodoc:
|
27
|
-
base.extend ClassMethods
|
28
|
-
end
|
24
|
+
require 'named-parameters/object'
|
29
25
|
|
30
|
-
|
26
|
+
module NamedParameters
|
31
27
|
# Returns the list of declared parameters for the calling method, ie: the
|
32
|
-
# concatenation `:required`, `:optional`, and `:oneof` parameter list as
|
28
|
+
# concatenation of `:required`, `:optional`, and `:oneof` parameter list as
|
33
29
|
# declared in the the `has_named_parameters` clause, or the list specified
|
34
30
|
# in either the `requires` and `recognizes` clause.
|
31
|
+
#
|
32
|
+
# has_named_parameters :foo, :required => [ :x ], :optional => [ :y ]
|
33
|
+
# def foo options = { }
|
34
|
+
# puts declared_parameters.inspect
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# foo :x => 1, :y => 2 # => [ :x, :y ]
|
35
38
|
#
|
36
39
|
# @param [Array<Symbol>] type limits the list of parameters returned to the
|
37
|
-
# parameter types specified.
|
40
|
+
# parameter types specified.
|
38
41
|
#
|
39
|
-
# @return [Array<Symbol>] the list of symbols representing the name of the
|
40
|
-
# parameters.
|
42
|
+
# @return [Array<Symbol>] the list of symbols representing the name of the
|
43
|
+
# declared parameters.
|
41
44
|
#
|
42
45
|
def declared_parameters type = [ :required, :optional, :oneof ]
|
43
46
|
klazz = self.instance_of?(Class) ? self : self.class
|
44
|
-
specs = klazz.send :
|
47
|
+
specs = klazz.send :method_specs
|
48
|
+
method = if block_given?
|
49
|
+
yield # insane-fucker! :-)
|
50
|
+
else
|
51
|
+
caller = calling_method
|
52
|
+
self.instance_of?(Class) ? :"self.#{caller}" : caller
|
53
|
+
end
|
45
54
|
|
46
|
-
|
47
|
-
method = self.instance_of?(Class) ? :"self.#{caller}" : caller
|
48
|
-
spec = specs[klazz.send(:key_for, method)]
|
49
|
-
return [] if spec.nil?
|
55
|
+
return [] unless spec = specs[klazz.send(:key_for, method)]
|
50
56
|
|
51
57
|
mapper = lambda{ |entry| entry.instance_of?(Hash) ? entry.keys.first : entry }
|
52
58
|
sorter = lambda{ |x, y| x.to_s <=> y.to_s }
|
53
|
-
|
54
59
|
Array(type).map{ |k| spec[k].map(&mapper) }.flatten.sort(&sorter)
|
55
60
|
end
|
56
61
|
|
62
|
+
# Returns the list of declared parameters for a specific method, ie: the
|
63
|
+
# concatenation of `:required`, `:optional`, and `:oneof` parameter list as
|
64
|
+
# declared in the the {#has_named_parameters} clause, or the list specified
|
65
|
+
# in either the `requires` and `recognizes` clause.
|
66
|
+
#
|
67
|
+
# has_named_parameters :foo, :required => [ :x ], :optional => [ :y ]
|
68
|
+
# def foo options = { }
|
69
|
+
# # ...
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# def bar
|
73
|
+
# puts declared_parameters_for(:foo).inspect
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# bar # => [ :x, :y ]
|
77
|
+
#
|
78
|
+
# @param [Symbol] method the name of the method in question.
|
79
|
+
#
|
80
|
+
# @param [Array<Symbol>] type limits the list of parameters returned to the
|
81
|
+
# parameter types specified.
|
82
|
+
#
|
83
|
+
# @return [Array<Symbol>] the list of symbols representing the name of the
|
84
|
+
# declared parameters.
|
85
|
+
#
|
57
86
|
def declared_parameters_for method, type = [ :required, :optional, :oneof ]
|
58
87
|
declared_parameters(type) { method }
|
59
88
|
end
|
@@ -61,14 +90,13 @@ module NamedParameters
|
|
61
90
|
# Filter out keys from `options` that are not declared as parameter to the
|
62
91
|
# method:
|
63
92
|
#
|
64
|
-
# has_named_parameters :foo, :
|
93
|
+
# has_named_parameters :foo, :required => :x
|
65
94
|
# def foo options = { }
|
66
95
|
# options.inspect
|
67
96
|
# end
|
68
97
|
#
|
69
|
-
# options = { :x => 1, :y => 2, :z => 3 }
|
70
|
-
#
|
71
98
|
# # the following will fail because :y and :z is not recognized/declared
|
99
|
+
# options = { :x => 1, :y => 2, :z => 3 }
|
72
100
|
# foo options # => ArgumentError!
|
73
101
|
#
|
74
102
|
# # the following will not fail because we've applied the filter
|
@@ -76,9 +104,9 @@ module NamedParameters
|
|
76
104
|
#
|
77
105
|
# @param [Hash] options the options argument to the method.
|
78
106
|
#
|
79
|
-
# @param [Array<Symbol>] the list of symbols representing the declared
|
80
|
-
# parameters used to filter `options`.
|
81
|
-
#
|
107
|
+
# @param [Array<Symbol>] filter the list of symbols representing the declared
|
108
|
+
# parameters used to filter `options`. If not specified then the list
|
109
|
+
# returned by {#declared_parameters} is used by default.
|
82
110
|
#
|
83
111
|
# @return [Hash] a `Hash` whose keys are limited to what's declared as
|
84
112
|
# as parameter to the method.
|
@@ -89,6 +117,12 @@ module NamedParameters
|
|
89
117
|
options.reject{ |key, value| !filter.include?(key) }
|
90
118
|
end
|
91
119
|
|
120
|
+
protected
|
121
|
+
def self.included base # :nodoc:
|
122
|
+
base.extend ClassMethods
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
92
126
|
# returns the name of the current method
|
93
127
|
def current_method # :nodoc:
|
94
128
|
caller[0][/`([^']*)'/, 1].to_sym
|
@@ -102,7 +136,7 @@ module NamedParameters
|
|
102
136
|
# this is the method used to validate the name of the received parameters
|
103
137
|
# (based on the defined spec) when an instrumented method is invoked.
|
104
138
|
#
|
105
|
-
def self.
|
139
|
+
def self.validate_method_specs name, params, spec # :nodoc:
|
106
140
|
mapper = lambda{ |n| n.instance_of?(Hash) ? n.keys.first : n }
|
107
141
|
optional = spec[:optional].map &mapper
|
108
142
|
required = spec[:required].map &mapper
|
@@ -188,7 +222,8 @@ module NamedParameters
|
|
188
222
|
[ k, v ]
|
189
223
|
} ]
|
190
224
|
spec[:mode] = mode
|
191
|
-
|
225
|
+
method_specs[key_for(method)] = spec
|
226
|
+
yield spec if block_given?
|
192
227
|
end
|
193
228
|
|
194
229
|
# Convenience method, equivalent to declaring:
|
@@ -200,11 +235,11 @@ module NamedParameters
|
|
200
235
|
# to be an `Array` of symbols matching the names of the required
|
201
236
|
# parameters.
|
202
237
|
#
|
203
|
-
def requires *params
|
238
|
+
def requires *params, &block
|
204
239
|
[ :'self.new', :initialize ].each do |method|
|
205
|
-
spec =
|
240
|
+
spec = method_specs[key_for method] || { }
|
206
241
|
spec.merge!(:required => params)
|
207
|
-
has_named_parameters method, spec, :strict
|
242
|
+
has_named_parameters method, spec, :strict, &block
|
208
243
|
end
|
209
244
|
end
|
210
245
|
|
@@ -217,11 +252,11 @@ module NamedParameters
|
|
217
252
|
# to be an `Array` of symbols matching the names of the optional
|
218
253
|
# parameters.
|
219
254
|
#
|
220
|
-
def recognizes *params
|
255
|
+
def recognizes *params, &block
|
221
256
|
[ :'self.new', :initialize ].each do |method|
|
222
|
-
spec =
|
257
|
+
spec = method_specs[key_for method] || { }
|
223
258
|
spec.merge!(:optional => params)
|
224
|
-
has_named_parameters method, spec, :strict
|
259
|
+
has_named_parameters method, spec, :strict, &block
|
225
260
|
end
|
226
261
|
end
|
227
262
|
|
@@ -262,7 +297,7 @@ module NamedParameters
|
|
262
297
|
def singleton_method_added name # :nodoc:
|
263
298
|
apply_method_spec :"self.#{name}" do
|
264
299
|
method = self.eigenclass.instance_method name
|
265
|
-
spec =
|
300
|
+
spec = method_specs[key_for :"self.#{name}"]
|
266
301
|
owner = "#{self.name}::"
|
267
302
|
eigenclass.instance_eval do
|
268
303
|
intercept method, owner, name, spec
|
@@ -275,7 +310,7 @@ module NamedParameters
|
|
275
310
|
def method_added name # :nodoc:
|
276
311
|
apply_method_spec name do
|
277
312
|
method = instance_method name
|
278
|
-
spec =
|
313
|
+
spec = method_specs[key_for name]
|
279
314
|
owner = "#{self.name}#"
|
280
315
|
intercept method, owner, name, spec
|
281
316
|
end
|
@@ -285,7 +320,7 @@ module NamedParameters
|
|
285
320
|
private
|
286
321
|
# apply instrumentation to method
|
287
322
|
def apply_method_spec method # :nodoc:
|
288
|
-
if
|
323
|
+
if method_specs.include? key_for(method) and !instrumenting?
|
289
324
|
@instrumenting = true
|
290
325
|
yield method
|
291
326
|
@instrumenting = false
|
@@ -311,7 +346,7 @@ module NamedParameters
|
|
311
346
|
params = defaults.merge params
|
312
347
|
|
313
348
|
# validate the parameters against the spec
|
314
|
-
NamedParameters::
|
349
|
+
NamedParameters::validate_method_specs fullname, params, spec
|
315
350
|
|
316
351
|
# inject the updated argument values for params into the arguments
|
317
352
|
# before actually making method invocation
|
@@ -321,8 +356,8 @@ module NamedParameters
|
|
321
356
|
end
|
322
357
|
|
323
358
|
# initialize specs table as needed
|
324
|
-
def
|
325
|
-
@
|
359
|
+
def method_specs # :nodoc:
|
360
|
+
@method_specs ||= { }
|
326
361
|
end
|
327
362
|
|
328
363
|
def key_for method
|
@@ -338,7 +373,7 @@ module NamedParameters
|
|
338
373
|
|
339
374
|
# initialize the @instrumenting instance variable (housekeeping)
|
340
375
|
def self.extended base # :nodoc:
|
341
|
-
base.instance_variable_set
|
376
|
+
base.instance_variable_set(:@instrumenting, false)
|
342
377
|
end
|
343
378
|
end
|
344
379
|
end
|
data/named-parameters.gemspec
CHANGED
@@ -5,21 +5,24 @@
|
|
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.15"
|
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
|
+
s.date = %q{2010-12-05}
|
13
13
|
s.description = %q{This gem simulates named-parameters in Ruby.
|
14
|
-
|
15
|
-
|
14
|
+
It's a complement to the common Ruby idiom of using Hash args to emulate
|
15
|
+
the use of named parameters. }
|
16
16
|
s.email = %q{jurisgalang@gmail.com}
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"README.md"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
+
".rspec",
|
22
23
|
"GPL-LICENSE",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
23
26
|
"MIT-LICENSE",
|
24
27
|
"README.md",
|
25
28
|
"RELEASENOTES",
|
@@ -30,10 +33,10 @@ Gem::Specification.new do |s|
|
|
30
33
|
"lib/named-parameters/object.rb",
|
31
34
|
"named-parameters.gemspec",
|
32
35
|
"spec/named-parameters_spec.rb",
|
33
|
-
"spec/spec.opts",
|
34
36
|
"spec/spec_helper.rb"
|
35
37
|
]
|
36
38
|
s.homepage = %q{http://github.com/jurisgalang/named-parameters}
|
39
|
+
s.licenses = [["MIT", "GPL"]]
|
37
40
|
s.require_paths = ["lib"]
|
38
41
|
s.rubygems_version = %q{1.3.7}
|
39
42
|
s.summary = %q{Poor man's named-parameters in Ruby}
|
@@ -47,14 +50,23 @@ Gem::Specification.new do |s|
|
|
47
50
|
s.specification_version = 3
|
48
51
|
|
49
52
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
-
s.add_development_dependency(%q<rspec>, ["
|
53
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
|
54
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
56
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
51
57
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
52
58
|
else
|
53
|
-
s.add_dependency(%q<rspec>, ["
|
59
|
+
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
62
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
54
63
|
s.add_dependency(%q<yard>, [">= 0"])
|
55
64
|
end
|
56
65
|
else
|
57
|
-
s.add_dependency(%q<rspec>, ["
|
66
|
+
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
67
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
68
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
69
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
58
70
|
s.add_dependency(%q<yard>, [">= 0"])
|
59
71
|
end
|
60
72
|
end
|
@@ -246,4 +246,45 @@ describe "NamedParameters" do
|
|
246
246
|
o.boogey.should eql []
|
247
247
|
DeclaredParameters.boogey(:w => :w, :a => :a).should eql [ :a, :b, :c, :w, :x, :y, :z ]
|
248
248
|
end
|
249
|
+
|
250
|
+
it "should be able to get the list of declared parameters for specified methods" do
|
251
|
+
class DeclaredParameters
|
252
|
+
has_named_parameters :'instance_method',
|
253
|
+
:required => [ :w ],
|
254
|
+
:optional => [ :x, [ :y, 1 ], { :z => 1 } ],
|
255
|
+
:oneof => [ :a, :b, :c ]
|
256
|
+
def instance_method opts = { }
|
257
|
+
end
|
258
|
+
|
259
|
+
has_named_parameters :'self.singleton_method',
|
260
|
+
:required => [ :w ],
|
261
|
+
:optional => [ :x, [ :y, 1 ], { :z => 1 } ],
|
262
|
+
:oneof => [ :a, :b, :c ]
|
263
|
+
def self.singleton_method opts = { }
|
264
|
+
end
|
265
|
+
|
266
|
+
def instance_method_parameters
|
267
|
+
declared_parameters_for :instance_method
|
268
|
+
end
|
269
|
+
|
270
|
+
def singleton_method_parameters
|
271
|
+
declared_parameters_for :'self.singleton_method'
|
272
|
+
end
|
273
|
+
|
274
|
+
class << self
|
275
|
+
def instance_method_parameters
|
276
|
+
declared_parameters_for :instance_method
|
277
|
+
end
|
278
|
+
|
279
|
+
def singleton_method_parameters
|
280
|
+
declared_parameters_for :'self.singleton_method'
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
o = DeclaredParameters.new(:x => 1, :y => 1)
|
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
|
+
end
|
249
290
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
1
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
3
4
|
require 'named-parameters'
|
4
|
-
require 'spec'
|
5
|
-
require 'spec/autorun'
|
6
5
|
|
7
|
-
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
8
11
|
|
9
12
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: named-parameters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 15
|
10
|
+
version: 0.0.15
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Juris Galang
|
@@ -15,29 +15,61 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-05 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 11
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 1
|
33
|
+
- 0
|
34
|
+
version: 2.1.0
|
22
35
|
name: rspec
|
36
|
+
requirement: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :development
|
23
39
|
prerelease: false
|
24
|
-
|
40
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
25
41
|
none: false
|
26
42
|
requirements:
|
27
|
-
- -
|
43
|
+
- - ~>
|
28
44
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
45
|
+
hash: 23
|
30
46
|
segments:
|
31
47
|
- 1
|
32
|
-
-
|
33
|
-
-
|
34
|
-
version: 1.
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
version: 1.0.0
|
51
|
+
name: bundler
|
52
|
+
requirement: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
35
54
|
type: :development
|
36
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 1
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 5
|
65
|
+
- 1
|
66
|
+
version: 1.5.1
|
67
|
+
name: jeweler
|
68
|
+
requirement: *id003
|
37
69
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
70
|
+
type: :development
|
39
71
|
prerelease: false
|
40
|
-
|
72
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
41
73
|
none: false
|
42
74
|
requirements:
|
43
75
|
- - ">="
|
@@ -46,9 +78,23 @@ dependencies:
|
|
46
78
|
segments:
|
47
79
|
- 0
|
48
80
|
version: "0"
|
81
|
+
name: rcov
|
82
|
+
requirement: *id004
|
83
|
+
- !ruby/object:Gem::Dependency
|
49
84
|
type: :development
|
50
|
-
|
51
|
-
|
85
|
+
prerelease: false
|
86
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
95
|
+
name: yard
|
96
|
+
requirement: *id005
|
97
|
+
description: "This gem simulates named-parameters in Ruby. \n It's a complement to the common Ruby idiom of using Hash args to emulate \n the use of named parameters. "
|
52
98
|
email: jurisgalang@gmail.com
|
53
99
|
executables: []
|
54
100
|
|
@@ -58,7 +104,10 @@ extra_rdoc_files:
|
|
58
104
|
- README.md
|
59
105
|
files:
|
60
106
|
- .document
|
107
|
+
- .rspec
|
61
108
|
- GPL-LICENSE
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
62
111
|
- MIT-LICENSE
|
63
112
|
- README.md
|
64
113
|
- RELEASENOTES
|
@@ -69,12 +118,12 @@ files:
|
|
69
118
|
- lib/named-parameters/object.rb
|
70
119
|
- named-parameters.gemspec
|
71
120
|
- spec/named-parameters_spec.rb
|
72
|
-
- spec/spec.opts
|
73
121
|
- spec/spec_helper.rb
|
74
122
|
has_rdoc: true
|
75
123
|
homepage: http://github.com/jurisgalang/named-parameters
|
76
|
-
licenses:
|
77
|
-
|
124
|
+
licenses:
|
125
|
+
- - MIT
|
126
|
+
- GPL
|
78
127
|
post_install_message:
|
79
128
|
rdoc_options: []
|
80
129
|
|