Class: Germinate::Publisher
- Inherits:
-
Object
- Object
- Germinate::Publisher
show all
- Defined in:
- lib/germinate/publisher.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name, librarian, options = {}) ⇒ Publisher
Returns a new instance of Publisher.
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/germinate/publisher.rb', line 38
def initialize(name, librarian, options={})
self.name = name
self.librarian = librarian
self.options = options
self.pipeline = librarian.make_pipeline(options.delete(:pipeline){""})
self.selector = options.delete(:selector) {
options.delete(:select){"$TEXT|_transform"}
}
options.keys.each do |key|
log.warn "Unknown publisher option '#{key}'"
end
end
|
Class Method Details
.identifier(*args) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/germinate/publisher.rb', line 28
def self.identifier(*args)
if args.empty?
@identifier
else
id = args.first
self.identifier = id
Germinate::Publisher.register_publisher_type(id, self)
end
end
|
.make(name, identifier, librarian, options) ⇒ Object
18
19
20
21
22
|
# File 'lib/germinate/publisher.rb', line 18
def self.make(name, identifier, librarian, options)
@registered_publishers.fetch(identifier).new(name, librarian, options)
rescue IndexError => error
raise error.exception("Unknown publisher type #{identifier.inspect}")
end
|
.register_publisher_type(identifier, klass) ⇒ Object
24
25
26
|
# File 'lib/germinate/publisher.rb', line 24
def self.register_publisher_type(identifier, klass)
@registered_publishers[identifier] = klass
end
|
Instance Method Details
53
54
55
56
|
# File 'lib/germinate/publisher.rb', line 53
def input
source = librarian[selector, "publish #{name} command"]
pipeline.call(source)
end
|