Sha256: 31c0a386f6a7c544718949a696d66e4ca097fefcabf471a697650f94240e1adf
Contents?: true
Size: 1.31 KB
Versions: 6
Compression:
Stored size: 1.31 KB
Contents
# Author:: Eric Crane (mailto:eric.crane@mac.com) # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved. # # Set the current context pointer. # Alternatively if no value is provided, just show the context. # module GlooLang module Verbs class Context < GlooLang::Core::Verb KEYWORD = 'context'.freeze KEYWORD_SHORT = '@'.freeze # # Run the verb. # def run set_context if @tokens.token_count > 1 show_context end # # Show the current context. # def show_context $log.show "Context: #{$engine.heap.context}" 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 # # Set the context to the given path. # def set_context path = @tokens.second $engine.heap.context.set_to path $engine.heap.it.set_to path $log.debug "Context set to #{$engine.heap.context}" end end end end
Version data entries
6 entries across 6 versions & 1 rubygems