Class: Procfs2::ProcFd
- Includes:
- Enumerable
- Defined in:
- lib/procfs2/proc_fd.rb
Constant Summary collapse
- LABEL =
:fd
Instance Attribute Summary
Attributes inherited from ProcItem
Instance Method Summary collapse
Methods inherited from ProcItem
#_filename, #_path, #_raw_content, build, #initialize
Constructor Details
This class inherits a constructor from Procfs2::ProcItem
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Procfs2::ProcItem
Instance Method Details
#_load_content ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/procfs2/proc_fd.rb', line 10 def _load_content @_data = [] Dir.foreach(_path) do |fd_entry| next if ['.', '..'].include?(fd_entry) fd_path = File.join(_path, fd_entry) fd_stat = File.stat(fd_path) @_data << ProcFdId.new(id: fd_entry, path: fd_path, stat: fd_stat) end end |
#each(&block) ⇒ Object
28 29 30 |
# File 'lib/procfs2/proc_fd.rb', line 28 def each(&block) _data&.each(&block) end |
#id(id) ⇒ Object
22 23 24 25 26 |
# File 'lib/procfs2/proc_fd.rb', line 22 def id(id) return unless _data _data.find { |element| element.id.to_s == id.to_s } end |