Class: Object

Inherits:
BasicObject
Defined in:
lib/core_ext/object.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


2
3
4
5
6
7
8
# File 'lib/core_ext/object.rb', line 2

def blank?
  if respond_to?(:empty?)
    nil? || empty?
  else
    nil?
  end
end

#to_paramObject



16
17
18
# File 'lib/core_ext/object.rb', line 16

def to_param
  to_s
end

#to_query(key) ⇒ Object



11
12
13
14
# File 'lib/core_ext/object.rb', line 11

def to_query(key)
  require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
  "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
end