Sha256: ab2f7894226cba1bda952e25b27fbcf0c99ee5181a2d3dcb6136d4c8669adf72
Contents?: true
Size: 1.78 KB
Versions: 2
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 GlooLang module Objs class Colorize < GlooLang::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 $log.show msg $engine.heap.it.set_to msg.to_s end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gloo-lang-0.9.4 | lib/gloo_lang/objs/cli/colorize.rb |
gloo-lang-0.9.3 | lib/gloo_lang/objs/cli/colorize.rb |