Class: Cow::Application::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/cow/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



9
10
11
# File 'lib/cow/application.rb', line 9

def initialize
  @servers = []
end

Instance Attribute Details

#serversObject

Returns the value of attribute servers.



7
8
9
# File 'lib/cow/application.rb', line 7

def servers
  @servers
end

Instance Method Details

#add_server(_server) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/cow/application.rb', line 13

def add_server(_server)
  @servers.each_with_index do |server, idx|
    if server.hostname == _server.hostname
      @servers[idx] = _server
      return _server
    end
  end

  @servers << _server
end