class ChefApply::UI::PlainTextHeader

Public Class Methods

new(format, opts) click to toggle source
# File lib/chef_apply/ui/plain_text_header.rb, line 22
def initialize(format, opts)
  @format = format
  @output = opts[:output]
  @children = {}
  @threads = []
end

Public Instance Methods

auto_spin() click to toggle source
# File lib/chef_apply/ui/plain_text_header.rb, line 35
def auto_spin
  msg = @format.gsub(/:spinner/, " HEADER ")
  @output.puts(msg)
  @children.each do |child, block|
    @threads << Thread.new { block.call(child) }
  end
  @threads.each(&:join)
end
register(child_format, child_opts, &block) click to toggle source
# File lib/chef_apply/ui/plain_text_header.rb, line 29
def register(child_format, child_opts, &block)
  child_opts[:output] = @output
  child = PlainTextElement.new(child_format, child_opts)
  @children[child] = block
end