Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
8538066e
Commit
8538066e
authored
Apr 12, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring collection wrapper
parent
2c92cc52
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
lib/github/collection.rb
lib/github/collection.rb
+4
-8
lib/github/repositories.rb
lib/github/repositories.rb
+1
-1
No files found.
lib/github/collection.rb
View file @
8538066e
module
Github
module
Github
class
Collection
class
Collection
def
initialize
(
url
)
def
fetch
(
url
,
query
=
{})
@url
=
url
return
[]
if
url
.
blank?
end
def
fetch
(
query
=
{})
return
[]
if
@url
.
blank?
Enumerator
.
new
do
|
yielder
|
Enumerator
.
new
do
|
yielder
|
loop
do
loop
do
response
=
client
.
get
(
@
url
,
query
)
response
=
client
.
get
(
url
,
query
)
response
.
body
.
each
{
|
item
|
yielder
<<
item
}
response
.
body
.
each
{
|
item
|
yielder
<<
item
}
raise
StopIteration
unless
response
.
rels
.
key?
(
:next
)
raise
StopIteration
unless
response
.
rels
.
key?
(
:next
)
@
url
=
response
.
rels
[
:next
]
url
=
response
.
rels
[
:next
]
end
end
end
.
lazy
end
.
lazy
end
end
...
...
lib/github/repositories.rb
View file @
8538066e
...
@@ -5,7 +5,7 @@ module Github
...
@@ -5,7 +5,7 @@ module Github
end
end
def
fetch
def
fetch
Collection
.
new
(
repos_url
).
fetch
Collection
.
new
.
fetch
(
repos_url
)
end
end
private
private
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment