Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/support/object.rb
Instance Method Summary collapse
Instance Method Details
#to_param ⇒ Object
8 9 10 |
# File 'lib/support/object.rb', line 8 def to_param to_s end |
#to_query(key) ⇒ Object
3 4 5 6 |
# File 'lib/support/object.rb', line 3 def to_query(key) require 'cgi' unless defined?(CGI) && defined?(CGI::escape) "#{CGI.escape(key.to_s).gsub(/%(5B|5D)/n) { [$1].pack('H*') }}=#{CGI.escape(to_param.to_s)}" end |
#try(method, *args, &block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/support/object.rb', line 12 def try(method, *args, &block) begin send(method, *args, &block) rescue nil end end |