Sha256: 58bcfcdfa6dc6ff830d4d801c2e5b406cd85a88b82241812529be7b14754c240

Contents?: true

Size: 828 Bytes

Versions: 8

Compression:

Stored size: 828 Bytes

Contents

module Restfulie
  module Client
    class StackNavigator
  
      def initialize(stack)
        @stack = stack.dup
      end

      def continue(request, env)
        current = @stack.pop
        if current.nil?
          return nil
        end
        filter = instantiator.new(current[:type], current[:args])
        Restfulie::Common::Logger.logger.debug "invoking filter #{filter.class.name} with #{request} at #{env}"
        filter.execute(self.dup, request, env)
      end
  
      def instantiator
        BasicInstantiator.new
      end
    
      def dup
        StackNavigator.new(@stack)
      end
  
    end

    class BasicInstantiator
      def new(type, args)
        if type.instance_method(:initialize).arity==1
          type.new(args)
        else
          type.new
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 lib/restfulie/client/stack_navigator.rb
restfulie-1.1.1 lib/restfulie/client/stack_navigator.rb
restfulie-1.1.0 lib/restfulie/client/stack_navigator.rb
restfulie-nosqlite-1.0.3 lib/restfulie/client/stack_navigator.rb
restfulie-1.0.3 lib/restfulie/client/stack_navigator.rb
restfulie-1.0.0 lib/restfulie/client/stack_navigator.rb
restfulie-1.0.0.beta5 lib/restfulie/client/stack_navigator.rb
restfulie-1.0.0.beta4 lib/restfulie/client/stack_navigator.rb