module DataKitten::Hosts::Github
GitHub host module. Automatically mixed into {Dataset} for datasets that are loaded from GitHub.
@see Dataset
Private Class Methods
supported?(uri)
click to toggle source
# File lib/data_kitten/hosts/github.rb, line 13 def self.supported?(uri) uri =~ /\A(git|https?):\/\/github\.com\// end
Public Instance Methods
github_path(path = '')
click to toggle source
Helper for generating GitHub URLs
@param path [String] The path to append to the GitHub base URL.
@return [String] The supplied path with the GitHub base URL prepended
@example
dataset = Dataset.new('git://github.com/theodi/dataset-metadata-survey.git') dataset.github_path # => 'https://github.com/theodi/dataset-metadata-survey/' dataset.github_path('issues') # => 'https://github.com/theodi/dataset-metadata-survey/issues'
# File lib/data_kitten/hosts/github.rb, line 36 def github_path(path = '') "https://github.com/#{github_user_name}/#{github_repository_name}/#{path}" end
host()
click to toggle source
Where the dataset is hosted. @return [Symbol] :github
@see Dataset#host
# File lib/data_kitten/hosts/github.rb, line 22 def host :github end
Private Instance Methods
github_repository_name()
click to toggle source
# File lib/data_kitten/hosts/github.rb, line 46 def github_repository_name @github_repository_name ||= uri.split('/')[-1].split('.')[0] end
github_user_name()
click to toggle source
# File lib/data_kitten/hosts/github.rb, line 42 def github_user_name @github_user_name ||= uri.split('/')[-2] end