Class: HawatelPS::Windows::ProcInfo
- Inherits:
-
ProcControl
- Object
- ProcControl
- HawatelPS::Windows::ProcInfo
- Defined in:
- lib/hawatel_ps/windows/proc_info.rb
Instance Method Summary collapse
-
#[](key) ⇒ Object
Make attributes of public.
-
#define_attributes(hash) ⇒ Object
private
Make attributes of public.
-
#each(&block) ⇒ Object
Calls the given block once for each element in self, passing that element as a parameter.
-
#initialize(proc_attrs) ⇒ void
constructor
Process instance with attributes of that process.
- #metaclasses ⇒ Object
Methods inherited from ProcControl
#resume, #status, #suspend, #terminate
Constructor Details
#initialize(proc_attrs) ⇒ void
Process instance with attributes of that process
7 8 9 10 |
# File 'lib/hawatel_ps/windows/proc_info.rb', line 7 def initialize(proc_attrs) @proc_attrs = proc_attrs define_attributes(proc_attrs) end |
Instance Method Details
#[](key) ⇒ Object
Make attributes of public. Access to process attribute from an object instance by index of array.
17 18 19 20 |
# File 'lib/hawatel_ps/windows/proc_info.rb', line 17 def [](key) key = key.to_s.downcase.to_sym if !key.is_a?(Symbol) @proc_attrs[key.downcase] end |
#define_attributes(hash) ⇒ Object (private)
Make attributes of public. Access to process attribute from an object instance by public method where names of attributes are methods.
43 44 45 46 47 48 |
# File 'lib/hawatel_ps/windows/proc_info.rb', line 43 def define_attributes(hash) hash.each_pair do |key, value| .send(:attr_reader, key.to_sym) instance_variable_set("@#{key}", value) end end |
#each(&block) ⇒ Object
Calls the given block once for each element in self, passing that element as a parameter.
28 29 30 |
# File 'lib/hawatel_ps/windows/proc_info.rb', line 28 def each(&block) @proc_attrs.each(&block) end |
#metaclasses ⇒ Object
33 34 35 |
# File 'lib/hawatel_ps/windows/proc_info.rb', line 33 def class << self; self; end end |