named-parameters 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/RELEASENOTES CHANGED
@@ -1,3 +1,7 @@
1
+ 0.0.11 [Nov 24, 2010]
2
+ - [BUGFIX] declared_parameters returns nil if called from an uninstrumented
3
+ method; it will now return an empty Array.
4
+
1
5
  0.0.10 [Nov 24, 2010]
2
6
  - [BREAKING CHANGE] required_parameters to declared_parameters. So to get the
3
7
  list of declared parameters for a method, do:
@@ -9,6 +13,7 @@
9
13
  end
10
14
 
11
15
  foobar # => [ :a, :b, :c ]
16
+
12
17
  - [INTERNAL] Parameter spec table is now retained.
13
18
 
14
19
  0.0.9 [Nov 24, 2010]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.10
1
+ 0.0.11
@@ -39,12 +39,14 @@ module NamedParameters
39
39
  def declared_parameters
40
40
  klazz = self.instance_of?(Class) ? self : self.class
41
41
  specs = klazz.send :specs
42
-
42
+
43
43
  method = self.instance_of?(Class) ? :"self.#{calling_method}" : calling_method
44
44
  spec = specs[klazz.send(:key_for, method)]
45
+ return [] if spec.nil?
45
46
 
46
47
  mapper = lambda{ |entry| entry.instance_of?(Hash) ? entry.keys.first : entry }
47
48
  sorter = lambda{ |x, y| x.to_s <=> y.to_s }
49
+
48
50
  [ :required, :optional, :oneof ].map{ |k| spec[k].map(&mapper) }.flatten.sort(&sorter)
49
51
  end
50
52
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{named-parameters}
8
- s.version = "0.0.10"
8
+ s.version = "0.0.11"
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"]
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: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Juris Galang