lib/vedeu/output/renderers/all.rb in vedeu-0.6.60 vs lib/vedeu/output/renderers/all.rb in vedeu-0.6.61
- old
+ new
@@ -15,21 +15,20 @@
# Vedeu.trigger(:_clear_)
# Vedeu.renderers.clear
#
# @return [Array<void>]
def clear
- threads = storage.map do |renderer|
+ storage.map do |renderer|
Vedeu.log(type: :output,
message: "Clearing via #{renderer.class.name}".freeze)
Thread.new(renderer) do
mutex.synchronize do
toggle_cursor { renderer.clear }
end
end
- end
- threads.each(&:join)
+ end.each(&:join) if Vedeu.ready?
''
end
# Provides access to the list of renderers.
@@ -49,21 +48,20 @@
# Vedeu.renderers.render(output)
#
# @param output [void]
# @return [Array<void>]
def render(output)
- threads = storage.map do |renderer|
+ storage.map do |renderer|
Vedeu.log(type: :output,
message: "Rendering via #{renderer.class.name}".freeze)
Thread.new(renderer) do
mutex.synchronize do
toggle_cursor { renderer.render(output) }
end
end
- end
- threads.each(&:join)
+ end.each(&:join) if Vedeu.ready?
output
end
# Adds the given renderer class(es) to the list of renderers.
@@ -81,15 +79,16 @@
storage
end
# @example
- # Vedeu.renderers.reset
+ # Vedeu.renderers.reset!
#
# @return [Set]
- def reset
+ def reset!
@storage = in_memory
end
+ alias_method :reset, :reset!
private
# @return [Set]
def in_memory