Class: Sumologic::Metadata::SourceMetadata
- Inherits:
-
Object
- Object
- Sumologic::Metadata::SourceMetadata
- Defined in:
- lib/sumologic/metadata/models.rb
Overview
Value object representing source metadata discovered from logs
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#message_count ⇒ Object
readonly
Returns the value of attribute message_count.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Sort by message count (descending).
-
#initialize(name:, category:, message_count:) ⇒ SourceMetadata
constructor
A new instance of SourceMetadata.
-
#to_h ⇒ Object
Convert to hash for JSON serialization.
Constructor Details
#initialize(name:, category:, message_count:) ⇒ SourceMetadata
Returns a new instance of SourceMetadata.
9 10 11 12 13 |
# File 'lib/sumologic/metadata/models.rb', line 9 def initialize(name:, category:, message_count:) @name = name @category = category @message_count = end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
7 8 9 |
# File 'lib/sumologic/metadata/models.rb', line 7 def category @category end |
#message_count ⇒ Object (readonly)
Returns the value of attribute message_count.
7 8 9 |
# File 'lib/sumologic/metadata/models.rb', line 7 def @message_count end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/sumologic/metadata/models.rb', line 7 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
Sort by message count (descending)
25 26 27 |
# File 'lib/sumologic/metadata/models.rb', line 25 def <=>(other) other. <=> @message_count end |
#to_h ⇒ Object
Convert to hash for JSON serialization
16 17 18 19 20 21 22 |
# File 'lib/sumologic/metadata/models.rb', line 16 def to_h { 'name' => @name, 'category' => @category, 'message_count' => @message_count }.compact end |