Class: Pid

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePid

Returns a new instance of Pid.



25
26
27
# File 'lib/common/pid.rb', line 25

def initialize
  @pid = Process.pid
end

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



22
23
24
# File 'lib/common/pid.rb', line 22

def pid
  @pid
end

Instance Method Details

#to_sObject



41
42
43
# File 'lib/common/pid.rb', line 41

def to_s
  @pid.to_s
end

#write_to_file(fileName) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/common/pid.rb', line 30

def write_to_file( fileName )
  if ( fileName == nil ) 
    raise IOException( 'File name is nil' )
  end
  
  pidHandle = File.new( fileName, 'w' )
  pidHandle.print( pid )
  pidHandle.close
end