module DataKitten::Hosts::Bitbucket
Bitbucket
host module. Automatically mixed into {Dataset} for datasets that are loaded from Bitbucket
.
@see Dataset
Private Class Methods
supported?(uri)
click to toggle source
# File lib/data_kitten/hosts/bitbucket.rb, line 13 def self.supported?(uri) uri =~ /\A(git|https?):\/\/[^\/]*bitbucket\.org\// end
Public Instance Methods
bitbucket_path(path = '')
click to toggle source
Helper for generating Bitbucket
URLs
@param path [String] The path to append to the Bitbucket
base URL.
@return [String] The supplied path with the Bitbucket
base URL prepended
@example
dataset = Dataset.new('https://bitbucket.org/floppy/hot-drinks.git') dataset.bitbucket_path # => 'https://bitbucket.org/floppy/hot-drinks/' dataset.bitbucket_path('pull-requests') # => 'https://bitbucket.org/floppy/hot-drinks/pull-requests'
# File lib/data_kitten/hosts/bitbucket.rb, line 36 def bitbucket_path(path = '') "https://bitbucket.org/#{bitbucket_user_name}/#{bitbucket_repository_name}/#{path}" end
host()
click to toggle source
Where the dataset is hosted. @return [Symbol] :bitbucket
@see Dataset#host
# File lib/data_kitten/hosts/bitbucket.rb, line 22 def host :bitbucket end
Private Instance Methods
bitbucket_repository_name()
click to toggle source
# File lib/data_kitten/hosts/bitbucket.rb, line 46 def bitbucket_repository_name @bitbucket_repository_name ||= uri.split('/')[-1].split('.')[0] end
bitbucket_user_name()
click to toggle source
# File lib/data_kitten/hosts/bitbucket.rb, line 42 def bitbucket_user_name @bitbucket_user_name ||= uri.split('/')[-2] end