Sha256: d48ff59ca200910f7822510d2e24293b382a0975bf76177cf0b2d4e89a603b7b

Contents?: true

Size: 970 Bytes

Versions: 16

Compression:

Stored size: 970 Bytes

Contents

class Tryouts
  class Tryout
    
    # All :api Drills are run within this context (not used for :cli). 
    # Each Drill is executed in a new instance of this class. That means
    # instance variables are not carried through, but class variables are. 
    # The before and after blocks are also run in this context.
    class DrillContext
        # An ordered Hash of stashed objects. 
      attr_writer :stash

      def initialize; @stash = Tryouts::HASH_TYPE.new; @has_dream = false; end

      # Set to to true by DrillContext#dream
      def has_dream?; @has_dream; end

      # If called with no arguments, returns +@stash+. 
      # If called with arguments, it will add a new value to the +@stash+
      # and return the new value.  e.g.
      #
      #     stash :name, 'some value'   # => 'some value'
      #
      def stash(*args)
        return @stash if args.empty?
        @stash[args[0]] = args[1] 
        args[1] 
      end
      
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
delano-tryouts-0.6.0 lib/tryouts/drill/context.rb
delano-tryouts-0.6.1 lib/tryouts/drill/context.rb
delano-tryouts-0.6.2 lib/tryouts/drill/context.rb
delano-tryouts-0.6.3 lib/tryouts/drill/context.rb
delano-tryouts-0.7.0 lib/tryouts/drill/context.rb
delano-tryouts-0.7.1 lib/tryouts/drill/context.rb
delano-tryouts-0.7.2 lib/tryouts/drill/context.rb
delano-tryouts-0.7.3 lib/tryouts/drill/context.rb
tryouts-0.6.0 lib/tryouts/drill/context.rb
tryouts-0.6.1 lib/tryouts/drill/context.rb
tryouts-0.6.2 lib/tryouts/drill/context.rb
tryouts-0.6.3 lib/tryouts/drill/context.rb
tryouts-0.7.0 lib/tryouts/drill/context.rb
tryouts-0.7.1 lib/tryouts/drill/context.rb
tryouts-0.7.2 lib/tryouts/drill/context.rb
tryouts-0.7.3 lib/tryouts/drill/context.rb