Class: ElasticGraph::Indexer::Operation::Result
- Inherits:
-
Data
- Object
- Data
- ElasticGraph::Indexer::Operation::Result
- Defined in:
- lib/elastic_graph/indexer/operation/result.rb
Overview
Describes the result of an operation. :category value will be one of: [:success, :noop, :failure]
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
Class Method Summary collapse
- .failure_of(operation, description) ⇒ Object
- .noop_of(operation, description) ⇒ Object
- .success_of(operation) ⇒ Object
Instance Method Summary collapse
- #event ⇒ Object
- #event_id ⇒ Object
- #inspect ⇒ Object (also: #to_s)
- #operation_type ⇒ Object
- #summary ⇒ Object
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category
16 17 18 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 16 def category @category end |
#description ⇒ Object (readonly)
Returns the value of attribute description
16 17 18 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 16 def description @description end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation
16 17 18 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 16 def operation @operation end |
Class Method Details
.failure_of(operation, description) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 34 def self.failure_of(operation, description) Result.new( category: :failure, operation: operation, description: description ) end |
.noop_of(operation, description) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 26 def self.noop_of(operation, description) Result.new( category: :noop, operation: operation, description: description ) end |
.success_of(operation) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 18 def self.success_of(operation) Result.new( category: :success, operation: operation, description: nil ) end |
Instance Method Details
#event ⇒ Object
46 47 48 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 46 def event operation.event end |
#event_id ⇒ Object
50 51 52 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 50 def event_id EventID.from_event(event) end |
#inspect ⇒ Object Also known as: to_s
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 61 def inspect parts = [ self.class.name, operation_type.inspect, category.inspect, event_id, description ].compact "#<#{parts.join(" ")}>" end |
#operation_type ⇒ Object
42 43 44 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 42 def operation_type operation.type end |
#summary ⇒ Object
54 55 56 57 58 59 |
# File 'lib/elastic_graph/indexer/operation/result.rb', line 54 def summary # :nocov: -- `description == nil` case is not covered; not simple to test. suffix = description ? "--#{description}" : nil # :nocov: "<#{operation.description} #{event_id} #{category}#{suffix}>" end |