Class: Tastevin::Agent

Inherits:
Object
  • Object
show all
Defined in:
lib/tastevin/agent.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host.



24
25
26
# File 'lib/tastevin/agent.rb', line 24

def host
  @host
end

#portObject

Returns the value of attribute port.



24
25
26
# File 'lib/tastevin/agent.rb', line 24

def port
  @port
end

Class Method Details

.get(config, key) ⇒ Object



16
17
18
# File 'lib/tastevin/agent.rb', line 16

def self.get(config, key)
  contact(config) { |agent| agent.get(key) }
end

.set(config, key, value) ⇒ Object



20
21
22
# File 'lib/tastevin/agent.rb', line 20

def self.set(config, key, value)
  contact(config) { |agent| agent.set(key, value) }
end

.status(config) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/tastevin/agent.rb', line 6

def self.status(config)
  begin
    contact(config).release

    :online
  rescue Error
    :offline
  end
end

Instance Method Details

#get(key) ⇒ Object



26
27
28
# File 'lib/tastevin/agent.rb', line 26

def get(key)
  @session.get(key)
end

#releaseObject



34
35
36
# File 'lib/tastevin/agent.rb', line 34

def release
  @session.close
end

#set(key, value) ⇒ Object



30
31
32
# File 'lib/tastevin/agent.rb', line 30

def set(key, value)
  @session.set(key, value)
end