Class: Skyscraper::Path::Remote
- Defined in:
- lib/skyscraper/path/remote.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#full_path ⇒ Object
Returns the value of attribute full_path.
-
#path ⇒ Object
Returns the value of attribute path.
-
#query ⇒ Object
Returns the value of attribute query.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #full_path_for(href) ⇒ Object
-
#initialize(path) ⇒ Remote
constructor
A new instance of Remote.
- #to_s ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(path) ⇒ Remote
Returns a new instance of Remote.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/skyscraper/path/remote.rb', line 6 def initialize path uri = URI.parse(path) if uri.scheme.present? @domain = uri.scheme + "://" + uri.host else @domain = uri.host end @path = uri.path @query = "?" + uri.query if uri.query @full_path = "#{@domain}#{@path}#{@query}" @base = "#{@domain}/" @uri = uri @file_name = get_file_name(@path) end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
4 5 6 |
# File 'lib/skyscraper/path/remote.rb', line 4 def base @base end |
#domain ⇒ Object
Returns the value of attribute domain.
4 5 6 |
# File 'lib/skyscraper/path/remote.rb', line 4 def domain @domain end |
#file_name ⇒ Object
Returns the value of attribute file_name.
4 5 6 |
# File 'lib/skyscraper/path/remote.rb', line 4 def file_name @file_name end |
#full_path ⇒ Object
Returns the value of attribute full_path.
4 5 6 |
# File 'lib/skyscraper/path/remote.rb', line 4 def full_path @full_path end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/skyscraper/path/remote.rb', line 4 def path @path end |
#query ⇒ Object
Returns the value of attribute query.
4 5 6 |
# File 'lib/skyscraper/path/remote.rb', line 4 def query @query end |
#uri ⇒ Object
Returns the value of attribute uri.
4 5 6 |
# File 'lib/skyscraper/path/remote.rb', line 4 def uri @uri end |
Instance Method Details
#full_path_for(href) ⇒ Object
23 24 25 |
# File 'lib/skyscraper/path/remote.rb', line 23 def full_path_for href @uri.merge(URI.parse(href)).to_s end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/skyscraper/path/remote.rb', line 27 def to_s self.full_path end |