Sha256: 92b8643c20bf5d20744c9868f7560baf14a51fb47a96a2274695e613f7add38b

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

class Object
  def to_param
    to_s
  end
end

class NilClass
  def to_param
    self
  end
end

class TrueClass
  def to_param
    self
  end
end

class FalseClass
  def to_param
    self
  end
end

class Array
  def to_param
    collect { |e| e.to_param }.join '/'
  end
end

class Hash
  def to_param(namespace = nil)
    collect do |key, value|
      value.to_query(namespace ? "#{namespace}[#{key}]" : key)
    end.sort * '&'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
happy_support-1.0.0 lib/happy_support/core_ext/object/to_param.rb