Class: Procfs2::ProcItem
- Inherits:
-
Object
- Object
- Procfs2::ProcItem
- Defined in:
- lib/procfs2/proc_item.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#_data ⇒ Object
readonly
Returns the value of attribute _data.
-
#_parent ⇒ Object
readonly
Returns the value of attribute _parent.
-
#_raw_content ⇒ Object
readonly
Returns the value of attribute _raw_content.
Class Method Summary collapse
Instance Method Summary collapse
- #_filename ⇒ Object
- #_path ⇒ Object
-
#initialize(parent:) ⇒ ProcItem
constructor
A new instance of ProcItem.
Constructor Details
#initialize(parent:) ⇒ ProcItem
7 8 9 10 11 12 |
# File 'lib/procfs2/proc_item.rb', line 7 def initialize(parent:) @_parent = parent @_data = nil _initialize_content end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **kwargs) ⇒ Object (private)
43 44 45 46 47 48 49 50 |
# File 'lib/procfs2/proc_item.rb', line 43 def method_missing(method_name, *args, **kwargs) return unless _data return _data[method_name.to_sym] if _data.key?(method_name.to_sym) return _data[method_name.to_s] if _data.key?(method_name.to_s) super end |
Instance Attribute Details
#_data ⇒ Object (readonly)
Returns the value of attribute _data.
5 6 7 |
# File 'lib/procfs2/proc_item.rb', line 5 def _data @_data end |
#_parent ⇒ Object (readonly)
Returns the value of attribute _parent.
5 6 7 |
# File 'lib/procfs2/proc_item.rb', line 5 def _parent @_parent end |
#_raw_content ⇒ Object (readonly)
Returns the value of attribute _raw_content.
5 6 7 |
# File 'lib/procfs2/proc_item.rb', line 5 def _raw_content @_raw_content end |
Class Method Details
.build(parent:) ⇒ Object
53 54 55 |
# File 'lib/procfs2/proc_item.rb', line 53 def build(parent:) new(parent: parent) end |
Instance Method Details
#_filename ⇒ Object
14 15 16 |
# File 'lib/procfs2/proc_item.rb', line 14 def _filename self.class::LABEL.to_s end |
#_path ⇒ Object
18 19 20 |
# File 'lib/procfs2/proc_item.rb', line 18 def _path File.join([_parent&._path, _filename].compact) end |