# File lib/core/core.rb, line 44 def self.logger return @@logger end
# File lib/core/core.rb, line 17 def initialize(data = {}, defaults = {}, force = true, set_initialized = true) super(data, defaults, force) @class_color = Util::Data.ensure_value(delete(:class_color, :cyan), :cyan) @class_label = self.class.to_s.downcase.gsub(/^nucleon::/, '') self.logger = delete(:logger, @class_label) self.ui = Config.new(export).defaults({ :resource => Util::Console.colorize(@class_label, @class_color) }) logger.debug('Initialized instance logger and interface') @initialized = true if set_initialized end
# File lib/core/core.rb, line 60 def self.ui return @@ui end
# File lib/core/core.rb, line 75 def self.ui_group(resource, color = :cyan) @@ui_lock.synchronize do begin ui_resource = ui.resource ui.resource = Util::Console.colorize(resource, color) yield(ui) ensure ui.resource = ui_resource end end end
# File lib/core/core.rb, line 33 def initialized? @initialized end
# File lib/core/core.rb, line 48 def logger=logger Util::Logger.loggers.delete(self.logger.resource) if self.logger if logger.is_a?(Util::Logger) @logger = logger else @logger = Util::Logger.new(logger) end end
# File lib/core/core.rb, line 64 def ui=ui if ui.is_a?(Util::Console) @ui = ui else @ui = Util::Console.new(ui) end end
# File lib/core/core.rb, line 90 def ui_group(resource, color = :cyan) ui_resource = ui.resource ui.resource = Util::Console.colorize(resource, color) yield(ui) ensure ui.resource = ui_resource end