Class: String

Inherits:
Object show all
Defined in:
lib/dynamic_assets/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#relative_url?Boolean

Returns true iff the receiver seems to be a relative, not a full, URL. By “relative url” we mean a URL with no host info, although it may begin with a slash.

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/dynamic_assets/core_extensions.rb', line 7

def relative_url?
  regexp = /^[^:\/]*:\/\/[^\/]*/
  self[regexp].nil?
end