blob: 78e8b97eb03ae9a9af85a108fe71bd27e8e42839 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
module Gitlab
module Import
module Github
module Mapper
class Base
def initialize(project, client)
@project = project
@client = client
end
def each
return enum_for(:each) unless block_given?
method = klass.to_s.underscore.pluralize
client.public_send(method).each do |raw|
yield(klass.new(attributes_for(raw)))
end
end
private
attr_reader :project, :client
def attributes_for
{}
end
def klass
raise NotImplementedError,
"#{self.class} does not implement #{__method__}"
end
end
end
end
end
end
|