Class: HrrRbLxns::Files
- Inherits:
-
Object
- Object
- HrrRbLxns::Files
- Includes:
- Enumerable
- Defined in:
- lib/hrr_rb_lxns/files.rb,
lib/hrr_rb_lxns/files/file.rb
Overview
Represents namespace files information in /proc/PID/ns/ directory of a process.
Defined Under Namespace
Classes: File
Instance Attribute Summary collapse
-
#cgroup ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :cgroup.
-
#ipc ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :ipc.
-
#mnt ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :mnt.
-
#net ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :net.
-
#pid ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :pid.
-
#pid_for_children ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :pid_for_children.
-
#time ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :time.
-
#time_for_children ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :time_for_children.
-
#user ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :user.
-
#uts ⇒ HrrRbLxns::Files::File
readonly
Returns the file information of attribute :uts.
Instance Method Summary collapse
-
#[](key) ⇒ HrrRbLxns::Files::File
Returns the file information of the specified key.
-
#each ⇒ Object
Calls the given block once for each key with associated file information.
-
#initialize(pid = "self") ⇒ Files
constructor
A new instance of Files.
Constructor Details
#initialize(pid = "self") ⇒ Files
Returns a new instance of Files.
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/hrr_rb_lxns/files.rb', line 79 def initialize pid="self" @mnt = File.new "/proc/#{pid}/ns/mnt" @uts = File.new "/proc/#{pid}/ns/uts" @ipc = File.new "/proc/#{pid}/ns/ipc" @net = File.new "/proc/#{pid}/ns/net" @pid = File.new "/proc/#{pid}/ns/pid" @pid_for_children = File.new "/proc/#{pid}/ns/pid_for_children" @user = File.new "/proc/#{pid}/ns/user" @cgroup = File.new "/proc/#{pid}/ns/cgroup" @time = File.new "/proc/#{pid}/ns/time" @time_for_children = File.new "/proc/#{pid}/ns/time_for_children" end |
Instance Attribute Details
#cgroup ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :cgroup.
63 64 65 |
# File 'lib/hrr_rb_lxns/files.rb', line 63 def cgroup @cgroup end |
#ipc ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :ipc.
33 34 35 |
# File 'lib/hrr_rb_lxns/files.rb', line 33 def ipc @ipc end |
#mnt ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :mnt.
21 22 23 |
# File 'lib/hrr_rb_lxns/files.rb', line 21 def mnt @mnt end |
#net ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :net.
39 40 41 |
# File 'lib/hrr_rb_lxns/files.rb', line 39 def net @net end |
#pid ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :pid.
45 46 47 |
# File 'lib/hrr_rb_lxns/files.rb', line 45 def pid @pid end |
#pid_for_children ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :pid_for_children.
51 52 53 |
# File 'lib/hrr_rb_lxns/files.rb', line 51 def pid_for_children @pid_for_children end |
#time ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :time.
69 70 71 |
# File 'lib/hrr_rb_lxns/files.rb', line 69 def time @time end |
#time_for_children ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :time_for_children.
75 76 77 |
# File 'lib/hrr_rb_lxns/files.rb', line 75 def time_for_children @time_for_children end |
#user ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :user.
57 58 59 |
# File 'lib/hrr_rb_lxns/files.rb', line 57 def user @user end |
#uts ⇒ HrrRbLxns::Files::File (readonly)
Returns the file information of attribute :uts.
27 28 29 |
# File 'lib/hrr_rb_lxns/files.rb', line 27 def uts @uts end |
Instance Method Details
#[](key) ⇒ HrrRbLxns::Files::File
Returns the file information of the specified key.
102 103 104 |
# File 'lib/hrr_rb_lxns/files.rb', line 102 def [] key __send__ key end |
#each ⇒ Object
Calls the given block once for each key with associated file information. If no block is given, an Enumerator is returned.
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/hrr_rb_lxns/files.rb', line 117 def each keys_with_files = [:mnt, :uts, :ipc, :net, :pid, :pid_for_children, :user, :cgroup, :time, :time_for_children].map{ |key| [key, __send__(key)] } if block_given? keys_with_files.each do |kv| yield kv end else keys_with_files.each end end |