Class: QCloudHive::GITURLDecoder
- Inherits:
-
Object
- Object
- QCloudHive::GITURLDecoder
- Defined in:
- lib/qcloudhive/git_helper.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#originURL ⇒ Object
readonly
Returns the value of attribute originURL.
-
#projectName ⇒ Object
readonly
Returns the value of attribute projectName.
Instance Method Summary collapse
-
#initialize(originURL) ⇒ GITURLDecoder
constructor
A new instance of GITURLDecoder.
- #validate? ⇒ Boolean
Constructor Details
#initialize(originURL) ⇒ GITURLDecoder
Returns a new instance of GITURLDecoder.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/qcloudhive/git_helper.rb', line 8 def initialize(originURL) @originURL = originURL if @originURL == nil raise NameError("改地址为空!!!") end uri = URI(originURL) uriPath = uri.path.split(".").first if uriPath.start_with?("/") uriPath= uriPath[1..uriPath.length] end name = uriPath.split("/").last @projectName = uriPath @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/qcloudhive/git_helper.rb', line 6 def name @name end |
#originURL ⇒ Object (readonly)
Returns the value of attribute originURL.
4 5 6 |
# File 'lib/qcloudhive/git_helper.rb', line 4 def originURL @originURL end |
#projectName ⇒ Object (readonly)
Returns the value of attribute projectName.
5 6 7 |
# File 'lib/qcloudhive/git_helper.rb', line 5 def projectName @projectName end |
Instance Method Details
#validate? ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/qcloudhive/git_helper.rb', line 22 def validate?() if @originURL == nil return false end if @name == nil return false end if @projectName == nil return false end return true end |