Sha256: 8909666133129f2eefe863c51c774b22e509e159ac3e15eda2a3a928dd67fdf9

Contents?: true

Size: 617 Bytes

Versions: 7

Compression:

Stored size: 617 Bytes

Contents

module Ona

  class Stack

    def initialize
      @list = []
      @id = 0
      @rack_machine = './'
    end

    def append &block
      @id += 1
      server = Server.new
      server.load_block(@id, &block)
      @list << server
    end

    def rack_machine path
      @rack_machine = path
    end

    def find num
      @list.each do |server|
        return server if server.id == num
      end
      nil
    end

    def find_all *args
      args.map { |id| find id }.compact
    end

    def exists? num
      return false if find(num).nil?
      true
    end

    def to_a
      @list
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ona-0.1.4 lib/ona_stack.rb
ona-0.1.3 lib/ona_stack.rb
ona-0.1.2 lib/ona_stack.rb
ona-0.1.1 lib/ona_stack.rb
ona-0.1.0 lib/ona_stack.rb
ona-0.0.2 lib/ona_stack.rb
ona-0.0.1 lib/ona_stack.rb