class Mocha::PrettyParameters

Public Class Methods

new(params) click to toggle source
# File lib/mocha/pretty_parameters.rb, line 5
def initialize(params)
  @params = params
  @params_string = params.mocha_inspect
end

Public Instance Methods

pretty() click to toggle source
# File lib/mocha/pretty_parameters.rb, line 10
def pretty
  remove_outer_array_braces!
  remove_outer_hash_braces!
  @params_string
end
remove_outer_array_braces!() click to toggle source
# File lib/mocha/pretty_parameters.rb, line 16
def remove_outer_array_braces!
  @params_string = @params_string.gsub(/^\[|\]$/, '')
end
remove_outer_hash_braces!() click to toggle source
# File lib/mocha/pretty_parameters.rb, line 20
def remove_outer_hash_braces!
  @params_string = @params_string.gsub(/^\{|\}$/, '') if @params.length == 1
end