Class: Procps::Column::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/procps/column.rb

Overview

The abstract class for complex column objects.

Direct Known Subclasses

Procps::Command, SchedulingPolicy

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Type

Returns a new instance of Type.



27
28
29
30
# File 'lib/procps/column.rb', line 27

def initialize(value)
  @original = value
  normalize if self.class.method_defined?(:normalize)
end

Instance Attribute Details

#originalObject (readonly) Also known as: to_s

Returns the value of attribute original.



24
25
26
# File 'lib/procps/column.rb', line 24

def original
  @original
end

Class Method Details

.call(value) ⇒ Object



40
41
42
# File 'lib/procps/column.rb', line 40

def self.call(value)
  new(value)
end

Instance Method Details

#inspectObject



36
37
38
# File 'lib/procps/column.rb', line 36

def inspect
  "<#{self.class}: #{to_h.inspect}>"
end

#to_hObject



32
33
34
# File 'lib/procps/column.rb', line 32

def to_h
   Hash[instance_variables.map { |name| [name[1..-1].to_sym, instance_variable_get(name)] }]
end