Class: ActiveMocker::Reparameterize Private
- Inherits:
-
Object
- Object
- ActiveMocker::Reparameterize
- Defined in:
- lib/active_mocker/reparameterize.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .call(params, param_list: nil) ⇒ Object private
- .method_arguments(params) ⇒ Object private
- .param_list(params) ⇒ Object private
Class Method Details
.call(params, param_list: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 8 |
# File 'lib/active_mocker/reparameterize.rb', line 5 def self.call(params, param_list:nil) return param_list(params) unless param_list.nil? method_arguments(params) end |
.method_arguments(params) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_mocker/reparameterize.rb', line 10 def self.method_arguments(params) params.map do |state, param| case state when :req param when :rest "*#{param}" when :opt "#{param}=nil" when :keyreq "#{param}:" when :key "#{param}: nil" end end.join(', ') end |
.param_list(params) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/active_mocker/reparameterize.rb', line 28 def self.param_list(params) params.map do |state, param| case state when :key, :keyreq "#{param}: #{param}" else param end end.join(', ') end |