Module: IMW::Resources::RemoteObj

Defined in:
lib/imw/resources/remote.rb

Overview

Defines methods appropriate for accessing a remote resource, no matter what the protocol.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(obj) ⇒ Object

TODO – self.extended should extend by RemoteDirectory when appropriate



12
13
14
# File 'lib/imw/resources/remote.rb', line 12

def self.extended obj
  obj.extend(RemoteFile)
end

Instance Method Details

#fragmentString

Return the fragment part of this resource’s URI. Will likely be nil for local resources.

Returns:



42
43
44
# File 'lib/imw/resources/remote.rb', line 42

def fragment
  @fragment ||= uri.fragment
end

#hostString

The host of this resource.

Returns:



26
27
28
# File 'lib/imw/resources/remote.rb', line 26

def host
  @host ||= uri.host
end

#is_remote?true, false

Is this resource on a remote host?

Returns:

  • (true, false)


19
20
21
# File 'lib/imw/resources/remote.rb', line 19

def is_remote?
  true
end

#pathString

Return the path part of this resource’s URI. Will not include the query_string or fragment.

Returns:



50
51
52
# File 'lib/imw/resources/remote.rb', line 50

def path
  @path ||= uri.path
end

#query_stringString

Return the query string part of this resource’s URI. Will likely be nil for local resources.

Returns:



34
35
36
# File 'lib/imw/resources/remote.rb', line 34

def query_string
  @query_string ||= uri.query
end