Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/core_blur/util/string.rb
Instance Method Summary collapse
Instance Method Details
#http_to_ssh ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/core_blur/util/string.rb', line 11 def http_to_ssh if self.start_with?("http://") or self.start_with?("https://") temp = self.gsub("https://","git@") temp = temp.gsub("http://","git@") url = URI(self) host = "#{url.host}:" temp = temp.gsub(url.host, host) temp = temp.gsub(":/", ":") unless temp.end_with?(".git") temp = "#{temp}.git" end temp else self end end |
#is_gitlab_url ⇒ Object
27 28 29 30 31 |
# File 'lib/core_blur/util/string.rb', line 27 def is_gitlab_url self.start_with?("git@gitlab") or self.start_with?("http://gitlab") or self.start_with?("https://gitlab") end |
#is_number? ⇒ Boolean
32 33 34 35 36 |
# File 'lib/core_blur/util/string.rb', line 32 def is_number? !!Kernel.Float(self) rescue TypeError, ArgumentError false end |
#ssh_to_http ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/core_blur/util/string.rb', line 2 def ssh_to_http if self.start_with?("git@") and self.end_with?(".git") temp = self.gsub(":","/") temp = temp.gsub("git@","http://") temp.gsub(".git","") else self end end |