Class: Procps::Column::Type
- Inherits:
-
Object
- Object
- Procps::Column::Type
- Defined in:
- lib/procps/column.rb
Overview
The abstract class for complex column objects.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#original ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute original.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(value) ⇒ Type
constructor
A new instance of Type.
- #inspect ⇒ Object
- #to_h ⇒ Object
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
#original ⇒ Object (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
#inspect ⇒ Object
36 37 38 |
# File 'lib/procps/column.rb', line 36 def inspect "<#{self.class}: #{to_h.inspect}>" end |
#to_h ⇒ Object
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 |