Class: Primate::URL

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

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

#hashObject (readonly)

Returns the value of attribute hash.



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

def hash
  @hash
end

#hostObject (readonly)

Returns the value of attribute host.



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

def host
  @host
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



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

def hostname
  @hostname
end

#hrefObject (readonly)

Returns the value of attribute href.



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

def href
  @href
end

#originObject (readonly)

Returns the value of attribute origin.



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

def origin
  @origin
end

#passwordObject (readonly)

Returns the value of attribute password.



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

def password
  @password
end

#pathnameObject (readonly)

Returns the value of attribute pathname.



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

def pathname
  @pathname
end

#portObject (readonly)

Returns the value of attribute port.



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

def port
  @port
end

#protocolObject (readonly)

Returns the value of attribute protocol.



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

def protocol
  @protocol
end

#searchObject (readonly)

Returns the value of attribute search.



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

def search
  @search
end

#usernameObject (readonly)

Returns the value of attribute username.



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

def username
  @username
end