Class: Procfs2::ProcNetTcp
- Includes:
- Enumerable
- Defined in:
- lib/procfs2/proc_net_tcp.rb
Constant Summary collapse
- LABEL =
:tcp
Instance Attribute Summary
Attributes inherited from ProcItem
#_data, #_parent, #_raw_content
Instance Method Summary collapse
Methods inherited from ProcItem
#_filename, #_path, 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 |
# File 'lib/procfs2/proc_net_tcp.rb', line 10 def _load_content @_data = [] lines = _raw_content.lines lines.shift @_data = lines.map { |socket_line| ProcNetTcpSocket.build_from_line(socket_line) } end |
#by_id(id) ⇒ Object
19 20 21 |
# File 'lib/procfs2/proc_net_tcp.rb', line 19 def by_id(id) @_data.find { |socket| socket.id == id.to_i } end |
#by_inode(inode) ⇒ Object
23 24 25 |
# File 'lib/procfs2/proc_net_tcp.rb', line 23 def by_inode(inode) @_data.find { |socket| socket.inode == inode.to_i } end |
#each(&block) ⇒ Object
27 28 29 |
# File 'lib/procfs2/proc_net_tcp.rb', line 27 def each(&block) _data&.each(&block) end |