named_parameters 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. data/README +1 -0
  2. data/lib/named_parameters.rb +28 -29
  3. metadata +2 -1
data/README CHANGED
@@ -136,6 +136,7 @@ Kudos to Juris Galang and his gem named-parameters. (http://www.rubygems.org/gem
136
136
  Defenitely have a look at this gem also, if you want to use named parameters.
137
137
 
138
138
  == Changelog
139
+ [1.0.2] * Removed unimportant methods from documentation (again)
139
140
  [1.0.1] * Removed unimportant methods from documentation
140
141
  [1.0.0] * Added strict and super modes
141
142
  * Smoother implementation
@@ -3,8 +3,34 @@
3
3
  #
4
4
  module NamedParameters
5
5
 
6
+ # Makes the next method callable via named parameters (options hash)
7
+ # The caller hash may only contain keys that are in the parameters of the next method
8
+ # @param [Hash[Symbol,Object]] optionals Optional default values for the parameters
9
+ def named_parameters_strict(optionals = { })
10
+ _named_parameters optionals, true, false
11
+ end
12
+
13
+ # Makes the next method callable via named parameters (options hash) and calls super with this options hash as the
14
+ # only parameter
15
+ # The caller hash may contain keys that are not contained in the parameters of the next method
16
+ # @param [Hash[Symbol,Object]] optionals Optional default values for the parameters
17
+ def named_parameters_super(optionals = { })
18
+ _named_parameters optionals, false, true
19
+ end
20
+
21
+ # Makes the next method callable via named parameters (options hash) and calls super with this options hash as the
22
+ # only parameter
23
+ # The caller hash may only contain keys that are in the parameters of the next method
24
+ # @param [Hash[Symbol,Object]] optionals Optional default values for the parameters
25
+ def named_parameters_strict_super(optionals = { })
26
+ _named_parameters optionals, true, true
27
+ end
28
+
29
+ alias_method :named_parameters_super_strict, :named_parameters_strict_super
30
+
31
+ private
32
+
6
33
  # Makes all methods of this module to class or module methods of include
7
- # @private
8
34
  def self.included base #:nodoc:
9
35
  base.extend(self)
10
36
  end
@@ -15,7 +41,7 @@ module NamedParameters
15
41
  private :method_added_before_named_parameters
16
42
  end
17
43
 
18
- # @private
44
+ # Makes sure a method is redefined as soon as it is defined. Only when named_parameters was called right before
19
45
  def method_added(method_name)
20
46
  # redefine the method
21
47
  if @redefine_next
@@ -37,33 +63,6 @@ module NamedParameters
37
63
  _named_parameters optionals, false, false
38
64
  end
39
65
 
40
- # Makes the next method callable via named parameters (options hash)
41
- # The caller hash may only contain keys that are in the parameters of the next method
42
- # @param [Hash[Symbol,Object]] optionals Optional default values for the parameters
43
- def named_parameters_strict(optionals = { })
44
- _named_parameters optionals, true, false
45
- end
46
-
47
- # Makes the next method callable via named parameters (options hash) and calls super with this options hash as the
48
- # only parameter
49
- # The caller hash may contain keys that are not contained in the parameters of the next method
50
- # @param [Hash[Symbol,Object]] optionals Optional default values for the parameters
51
- def named_parameters_super(optionals = { })
52
- _named_parameters optionals, false, true
53
- end
54
-
55
- # Makes the next method callable via named parameters (options hash) and calls super with this options hash as the
56
- # only parameter
57
- # The caller hash may only contain keys that are in the parameters of the next method
58
- # @param [Hash[Symbol,Object]] optionals Optional default values for the parameters
59
- def named_parameters_strict_super(optionals = { })
60
- _named_parameters optionals, true, true
61
- end
62
-
63
- alias_method :named_parameters_super_strict, :named_parameters_strict_super
64
-
65
- private
66
-
67
66
  # @param [Hash[Symbol,Object]] optionals Optional default values for the parameters
68
67
  # @param [Boolean] strict Shall keys in the caller options hash, that are not in the parameter list, throw an error?
69
68
  # @param [Boolean] call_super Shall super be called with the caller option hash as the only parameter?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: named_parameters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -61,6 +61,7 @@ rdoc_options:
61
61
  - --main
62
62
  - README
63
63
  - --line_numbers
64
+ - --no-private
64
65
  require_paths:
65
66
  - lib
66
67
  required_ruby_version: !ruby/object:Gem::Requirement