Sha256: 8ce9c54bdd36ed120a14062f6b68d81af37eecf3a1b4ec2286c41ee5f1ffa890

Contents?: true

Size: 791 Bytes

Versions: 6

Compression:

Stored size: 791 Bytes

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2020 Eric Crane.  All rights reserved.
#
# Wait for the given number of seconds.
#

module GlooLang
  module Verbs
    class Wait < GlooLang::Core::Verb

      KEYWORD = 'wait'.freeze
      KEYWORD_SHORT = 'w'.freeze

      #
      # Run the verb.
      #
      def run
        x = 1
        if @tokens.token_count > 1
          expr = GlooLang::Expr::Expression.new( @tokens.params )
          x = expr.evaluate.to_i
        end
        sleep x
      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

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gloo-lang-0.9.8 lib/gloo_lang/verbs/wait.rb
gloo-lang-0.9.7 lib/gloo_lang/verbs/wait.rb
gloo-lang-0.9.6 lib/gloo_lang/verbs/wait.rb
gloo-lang-0.9.5 lib/gloo_lang/verbs/wait.rb
gloo-lang-0.9.4 lib/gloo_lang/verbs/wait.rb
gloo-lang-0.9.3 lib/gloo_lang/verbs/wait.rb