Sha256: 297d8d2952aea674f6227733a24aa7fcae703b9d13892182133f9c156ffbf003
Contents?: true
Size: 1.43 KB
Versions: 20
Compression:
Stored size: 1.43 KB
Contents
# Author:: Eric Crane (mailto:eric.crane@mac.com) # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved. # # Show a single object's value. # module Gloo module Verbs class Show < Gloo::Core::Verb KEYWORD = 'show'.freeze KEYWORD_SHORT = '='.freeze # # Run the verb. # def run if @tokens.token_count > 1 expr = Gloo::Expr::Expression.new( @engine, @tokens.params ) result = expr.evaluate @engine.log.show get_formatted_string( result ) @engine.heap.it.set_to result else @engine.log.show '' end end # # Get the Verb's keyword. # def self.keyword return KEYWORD end # # Get the Verb's keyword shortcut. # def self.keyword_shortcut return KEYWORD_SHORT end # --------------------------------------------------------------------- # Private functions # --------------------------------------------------------------------- private # # Get the formatted string. # def get_formatted_string( str ) if @params&.token_count&.positive? expr = Gloo::Expr::Expression.new( @engine, @params.tokens ) val = expr.evaluate color = val.to_sym return @engine.platform.getColorizedString( str, color ) end return str end end end end
Version data entries
20 entries across 20 versions & 1 rubygems