Class: Primate::URL

Inherits:
Object
  • Object
show all
Defined in:
lib/primate/url.rb,
sig/primate.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ URL

initialize URL from JavaScript URL object

Parameters:

  • url (Object) —

    JavaScript URL object from the runtime



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/primate/url.rb', line 10

def initialize(url)
  @href = url['href'].to_s
  @origin = url['origin'].to_s
  @protocol = url['protocol'].to_s
  @username = url['username'].to_s
  @password = url['password'].to_s
  @host = url['host'].to_s
  @hostname = url['hostname'].to_s
  @port = url['port'].to_s
  @pathname = url['pathname'].to_s
  @search = url['search'].to_s
  @hash = url['hash'].to_s
end

Instance Attribute Details

#hash ⇒ String (readonly)

Returns the value of attribute hash.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def hash
  @hash
end

#host ⇒ String (readonly)

Returns the value of attribute host.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def host
  @host
end

#hostname ⇒ String (readonly)

Returns the value of attribute hostname.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def hostname
  @hostname
end

#href ⇒ String (readonly)

Returns the value of attribute href.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def href
  @href
end

#origin ⇒ String (readonly)

Returns the value of attribute origin.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def origin
  @origin
end

#password ⇒ String (readonly)

Returns the value of attribute password.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def password
  @password
end

#pathname ⇒ String (readonly)

Returns the value of attribute pathname.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def pathname
  @pathname
end

#port ⇒ String (readonly)

Returns the value of attribute port.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def port
  @port
end

#protocol ⇒ String (readonly)

Returns the value of attribute protocol.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def protocol
  @protocol
end

#search ⇒ String (readonly)

Returns the value of attribute search.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def search
  @search
end

#username ⇒ String (readonly)

Returns the value of attribute username.

Returns:

  • (String)


5
6
7
# File 'lib/primate/url.rb', line 5

def username
  @username
end