Class: Pennyworth::Loaders::GitHub

Inherits:
Object
  • Object
show all
Defined in:
lib/pennyworth/loaders/git_hub.rb

Overview

Loads an array projects from the GitHub API.

Instance Method Summary collapse

Constructor Details

#initialize(endpoint: Ghub::Endpoints::Repositories::Root.new) ⇒ GitHub

Returns a new instance of GitHub.



10
11
12
# File 'lib/pennyworth/loaders/git_hub.rb', line 10

def initialize endpoint: Ghub::Endpoints::Repositories::Root.new
  @endpoint = endpoint
end

Instance Method Details

#call(path) ⇒ Object



14
# File 'lib/pennyworth/loaders/git_hub.rb', line 14

def call(path) = endpoint.index(*path.split("/")).value_or(Core::EMPTY_ARRAY).map(&:to_h)