Class: QCloudHive::GITURLDecoder

Inherits:
Object
  • Object
show all
Defined in:
lib/qcloudhive/git_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.


6
7
8
# File 'lib/qcloudhive/git_helper.rb', line 6

def name
  @name
end

#originURLObject (readonly)

Returns the value of attribute originURL.


4
5
6
# File 'lib/qcloudhive/git_helper.rb', line 4

def originURL
  @originURL
end

#projectNameObject (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

Returns:

  • (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