Class: Lepus::Processes::Base

Inherits:
Object
  • Object
show all
Includes:
AppExecutor, Callbacks, Interruptible, Procline, Registrable
Defined in:
lib/lepus/processes/base.rb

Direct Known Subclasses

Consumers::Worker, Supervisor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Procline

#procline

Methods included from Interruptible

#interrupt

Methods included from Registrable

included

Methods included from AppExecutor

#handle_thread_error, #wrap_in_app_executor

Methods included from Callbacks

included

Constructor Details

#initializeBase

Returns a new instance of Base.



14
15
16
# File 'lib/lepus/processes/base.rb', line 14

def initialize(*)
  @stopped = false
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/lepus/processes/base.rb', line 12

def name
  @name
end

Instance Method Details

#hostnameObject



22
23
24
# File 'lib/lepus/processes/base.rb', line 22

def hostname
  @hostname ||= Socket.gethostname.force_encoding(Encoding::UTF_8)
end

#kindObject



18
19
20
# File 'lib/lepus/processes/base.rb', line 18

def kind
  self.class.name.split("::").last
end

#metadataObject



30
31
32
# File 'lib/lepus/processes/base.rb', line 30

def 
  {}
end

#pidObject



26
27
28
# File 'lib/lepus/processes/base.rb', line 26

def pid
  @pid ||= ::Process.pid
end

#stopObject



34
35
36
# File 'lib/lepus/processes/base.rb', line 34

def stop
  @stopped = true
end