Sha256: 9c00a8d15957a1842f8f61cf48705e5598803212b0585dfa76f82af77427ec6b
Contents?: true
Size: 974 Bytes
Versions: 1
Compression:
Stored size: 974 Bytes
Contents
module ActiveMocker # @api private class Reparameterize def self.call(params, method_parameters: nil) return method_parameters(params) unless method_parameters.nil? method_arguments(params) end # Method arguments are the real values passed to (and received by) the function. 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 # Method parameters are the names listed in the function definition. def self.method_parameters(params) params.map do |state, param| case state when :key, :keyreq "#{param}: #{param}" else param end end.join(', ') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_mocker-1.8.4 | lib/active_mocker/reparameterize.rb |