Class: EssCee::Service

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname, details) ⇒ Service

Returns a new instance of Service.



5
6
7
# File 'lib/service.rb', line 5

def initialize(hostname, details)
  @hostname, @name, @display_name, @type, @state = hostname, details[:name], details[:display_name], details[:type], details[:state]
end

Instance Attribute Details

#display_nameObject (readonly)

Returns the value of attribute display_name.



3
4
5
# File 'lib/service.rb', line 3

def display_name
  @display_name
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/service.rb', line 3

def name
  @name
end

#stateObject (readonly)

Returns the value of attribute state.



3
4
5
# File 'lib/service.rb', line 3

def state
  @state
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/service.rb', line 3

def type
  @type
end

Instance Method Details

#startObject



13
14
15
# File 'lib/service.rb', line 13

def start
  %x[sc \\\\#{@hostname} start #{@name}]
end

#stopObject



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

def stop
  %x[sc \\\\#{@hostname} stop #{@name}]
end