Class: Build::URI::Triplet
- Inherits:
-
Struct
- Object
- Struct
- Build::URI::Triplet
- Includes:
- Base
- Defined in:
- lib/build/uri/triplet.rb
Constant Summary collapse
- PARSER =
%r{\A (?:(?<userinfo>.+)@)? (?<host>[\w.-]+) :(?<path>.*) \z}x.freeze
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
-
#userinfo ⇒ Object
Returns the value of attribute userinfo.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Base
#+, #basename, #dirname, #merge
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host
23 24 25 |
# File 'lib/build/uri/triplet.rb', line 23 def host @host end |
#path ⇒ Object
Returns the value of attribute path
23 24 25 |
# File 'lib/build/uri/triplet.rb', line 23 def path @path end |
#userinfo ⇒ Object
Returns the value of attribute userinfo
23 24 25 |
# File 'lib/build/uri/triplet.rb', line 23 def userinfo @userinfo end |
Class Method Details
.parse(string) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/build/uri/triplet.rb', line 48 def self.parse(string) if match = PARSER.match(string) self.new( match[:userinfo], match[:host], match[:path], ).freeze end end |
Instance Method Details
#local? ⇒ Boolean
32 33 34 |
# File 'lib/build/uri/triplet.rb', line 32 def local? false end |
#to_s ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/build/uri/triplet.rb', line 36 def to_s buffer = String.new if userinfo buffer << userinfo << '@' end buffer << host << ':' << path return buffer end |