Class: Ganapati::FileUrl
- Inherits:
-
Object
- Object
- Ganapati::FileUrl
- Defined in:
- lib/ganapati/utils.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
Instance Method Summary collapse
- #hdfs? ⇒ Boolean
-
#initialize(url, default_scheme = 'yourmom', default_host = 'localhost', default_port = 8118) ⇒ FileUrl
constructor
A new instance of FileUrl.
- #local? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(url, default_scheme = 'yourmom', default_host = 'localhost', default_port = 8118) ⇒ FileUrl
Returns a new instance of FileUrl.
5 6 7 8 9 10 11 12 |
# File 'lib/ganapati/utils.rb', line 5 def initialize(url, default_scheme='yourmom', default_host='localhost', default_port=8118) @url = url if @url.start_with? 'file://' or (not @url.start_with? 'hdfs://' and default_scheme == :file) parse_file_scheme else parse_hdfs_scheme(default_host, default_port) end end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/ganapati/utils.rb', line 3 def host @host end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/ganapati/utils.rb', line 3 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
3 4 5 |
# File 'lib/ganapati/utils.rb', line 3 def port @port end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
3 4 5 |
# File 'lib/ganapati/utils.rb', line 3 def scheme @scheme end |
Instance Method Details
#hdfs? ⇒ Boolean
18 19 20 |
# File 'lib/ganapati/utils.rb', line 18 def hdfs? @scheme == :hdfs end |
#local? ⇒ Boolean
22 23 24 |
# File 'lib/ganapati/utils.rb', line 22 def local? @scheme == :file end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/ganapati/utils.rb', line 14 def to_s @url end |