Sha256: 3751cb00de4e0b60e57f5254bfa44cfe6d3f0179c8b8d01a6f3d0c6a7d9dd0e5

Contents?: true

Size: 779 Bytes

Versions: 9

Compression:

Stored size: 779 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 Gloo
  module Verbs
    class Wait < Gloo::Core::Verb

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

      #
      # Run the verb.
      #
      def run
        x = 1
        if @tokens.token_count > 1
          expr = Gloo::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

9 entries across 9 versions & 1 rubygems

Version Path
gloo-0.8.0 lib/gloo/verbs/wait.rb
gloo-0.7.7 lib/gloo/verbs/wait.rb
gloo-0.7.6 lib/gloo/verbs/wait.rb
gloo-0.7.5 lib/gloo/verbs/wait.rb
gloo-0.7.4 lib/gloo/verbs/wait.rb
gloo-0.7.3 lib/gloo/verbs/wait.rb
gloo-0.7.2 lib/gloo/verbs/wait.rb
gloo-0.7.1 lib/gloo/verbs/wait.rb
gloo-0.7.0 lib/gloo/verbs/wait.rb