Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/http/cookie/ruby_compat.rb

Instance Method Summary collapse

Instance Method Details

#try_convert(object) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/http/cookie/ruby_compat.rb', line 34

def try_convert(object)
  if object.is_a?(String) ||
      (object.respond_to?(:to_str) && (object = object.to_str).is_a?(String))
    object
  else
    nil
  end
end