machine 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfb7c20991449ccff51f78bde3b2568dc4c277fd
4
- data.tar.gz: 051e5c64d7076ba43e4205d4219a85bbc758e236
3
+ metadata.gz: 8f1bb892405863d3dcd07161e20bbc44d5bc6614
4
+ data.tar.gz: fcb74daf1c84f1f81a235f64a0c12f4333710a1f
5
5
  SHA512:
6
- metadata.gz: 9ceb3124d8bdbb9edda0953eae07ecde0530d9f96d02d56e043bca0c03d75fccea102796d9eeef87cc3ef1429b02db145d7313eec3065559680da31b561fbfc3
7
- data.tar.gz: ff5db3bd775af110bff27972c45e2126677c87e259da9cbbc6475a257f77eae2a22fe5d23a8c6d85c68441d2e7d5a9fe87fddd8a84fe6f9adb35730e56ccb8ae
6
+ metadata.gz: 9d1521233f0c509cac321c9ea6700e93cc6b3ac563d2609f17a850514bdb5df9bff035f41e1c9e6f476ef535ec77cb1cb14812c1a66fc8ddff57c13b41207264
7
+ data.tar.gz: ca2f07ed93c0ceb794f60879b1dc4dbbeb981de16750e851d48b1e5663136f336530b1d94848b3bc97e925aa6023943686140461248851aa454add9fa5ab6f78
@@ -24,7 +24,11 @@ module Machine
24
24
 
25
25
  module Helpers
26
26
  def created_at
27
- @created_at ||= File.ctime("/proc/#{pid}")
27
+ @created_at ||= begin
28
+ File.ctime("/proc/#{pid}")
29
+ rescue Errno::ENOENT => exception
30
+ nil
31
+ end
28
32
  end
29
33
  end
30
34
  end
@@ -3,6 +3,15 @@ require 'sys/proctable'
3
3
  require 'delegate'
4
4
 
5
5
  module Machine
6
+ class NullObject
7
+ def method_missing(name, *args, &block)
8
+ nil
9
+ end
10
+
11
+ def respond_to?(name)
12
+ true
13
+ end
14
+ end
6
15
  class ProcessStatus < SimpleDelegator
7
16
  include Sys
8
17
  include Helpers
@@ -10,7 +19,7 @@ module Machine
10
19
  attr_reader :pid
11
20
 
12
21
  def initialize(pid)
13
- super ProcTable.ps(@pid = pid)
22
+ super ProcTable.ps(@pid = pid) || NullObject.new
14
23
  end
15
24
 
16
25
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Machine
3
- VERSION = "0.0.4"
3
+ VERSION = "0.1.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - chatgris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-05 00:00:00.000000000 Z
11
+ date: 2013-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sys-proctable
@@ -64,3 +64,4 @@ signing_key:
64
64
  specification_version: 4
65
65
  summary: Machine collects some informations about cpu, memory, processes.
66
66
  test_files: []
67
+ has_rdoc: