Class: HAStats::Actions::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hastats/actions/base.rb

Direct Known Subclasses

Disable, Enable, Info, Stat

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(socket, options = {}) ⇒ Base

Returns a new instance of Base.



5
6
7
8
# File 'lib/hastats/actions/base.rb', line 5

def initialize(socket, options={})
  self.socket = socket.is_a?(HAStats::Socket) ? socket : HAStats::Socket.new(socket)
  self.options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/hastats/actions/base.rb', line 3

def options
  @options
end

#socketObject

Returns the value of attribute socket.



3
4
5
# File 'lib/hastats/actions/base.rb', line 3

def socket
  @socket
end

Instance Method Details

#command(*args) ⇒ Object

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/hastats/actions/base.rb', line 18

def command(*args)
  raise NotImplementedError
end

#responseObject



14
15
16
# File 'lib/hastats/actions/base.rb', line 14

def response
  HAStats::Responses::Base
end

#run(*args) ⇒ Object



10
11
12
# File 'lib/hastats/actions/base.rb', line 10

def run(*args)
  response.new socket.run(command(*args))
end