Sha256: 907d07e081447825a4c0236c4fbf2d3f8af4c7fc39aefdf9b599e62fcb3e2ed3
Contents?: true
Size: 1.78 KB
Versions: 19
Compression:
Stored size: 1.78 KB
Contents
# Author:: Eric Crane (mailto:eric.crane@mac.com) # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved. # # Show colorized output. # require 'colorized_string' module Gloo module Objs class Colorize < Gloo::Core::Obj KEYWORD = 'colorize'.freeze KEYWORD_SHORT = 'color'.freeze # # The name of the object type. # def self.typename return KEYWORD end # # The short name of the object type. # def self.short_typename return KEYWORD_SHORT end # --------------------------------------------------------------------- # Children # --------------------------------------------------------------------- # Does this object have children to add when an object # is created in interactive mode? # This does not apply during obj load, etc. def add_children_on_create? return true end # Add children to this object. # This is used by containers to add children needed # for default configurations. def add_default_children fac = @engine.factory fac.create_string 'white', '', self end # --------------------------------------------------------------------- # Messages # --------------------------------------------------------------------- # # Get a list of message names that this object receives. # def self.messages return super + [ 'run' ] end # # Run the colorize command. # def msg_run msg = '' children.each do |o| msg += ColorizedString[ o.value_display ].colorize( o.name.to_sym ) end @engine.log.show msg @engine.heap.it.set_to msg.to_s end end end end
Version data entries
19 entries across 19 versions & 1 rubygems