Sha256: 7a563e1c51b079f47dd00a8a3aaec8702233bc7e03aee7dc3d7d6ba2367812d7

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

# frozen_string_literal: true

# :nodoc:
# @api private
class String
  # :nodoc:
  # @api private
  def to_route_param
    return self if start_with?(":")

    ":#{+self}"
  end unless method_defined?(:to_route_param)
end

# :nodoc:
# @api private
class Symbol
  # :nodoc:
  # @api private
  def to_route_param
    to_s.to_route_param
  end unless method_defined?(:to_route_param)
end

# :nodoc:
# @api private
class Hash
  # :nodoc:
  # @api private
  def to_route_param
    each_with_object({}) do |(key, value), memo|
      memo[key.to_route_param] = value
    end
  end unless method_defined?(:to_route_param)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stub_requests-0.1.5 lib/stub_requests/core_ext/string/to_route_param.rb
stub_requests-0.1.4 lib/stub_requests/core_ext/string/to_route_param.rb