Skip to content

Commit

Permalink
Refactor RepositoryFetcher
Browse files Browse the repository at this point in the history
Extract repository conversion into methods
  • Loading branch information
sarahhodne committed Dec 2, 2012
1 parent 7b493c4 commit 30a9cde
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/travis/lite/models/repository_fetcher.rb
Expand Up @@ -18,11 +18,21 @@ def initialize(api)
end

def fetch_recent
@api.fetch_recent.map { |repository| Repository.new(repository) }
convert_to_repositories(@api.fetch_recent)
end

def fetch_with_slug(slug)
Repository.new(@api.fetch_with_slug(slug))
convert_to_repository(@api.fetch_with_slug(slug))
end

private

def convert_to_repositories(repositories)
repositories.map { |repository| convert_to_repository(repository) }
end

def convert_to_repository(repository)
Repository.new(repository)
end
end
end
Expand Down

0 comments on commit 30a9cde

Please sign in to comment.