Class: RedisClient::Cluster::ErrorCollection
- Defined in:
- lib/redis_client/cluster/errors.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(error_message = nil) ⇒ ErrorCollection
constructor
A new instance of ErrorCollection.
- #with_errors(errors) ⇒ Object
Methods inherited from Error
Constructor Details
#initialize(error_message = nil) ⇒ ErrorCollection
Returns a new instance of ErrorCollection.
52 53 54 55 |
# File 'lib/redis_client/cluster/errors.rb', line 52 def initialize( = nil) @errors = nil super end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
41 42 43 |
# File 'lib/redis_client/cluster/errors.rb', line 41 def errors @errors end |
Class Method Details
.with_errors(errors) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/redis_client/cluster/errors.rb', line 43 def self.with_errors(errors) if !errors.is_a?(Hash) || errors.empty? new(errors.to_s).with_errors(EMPTY_HASH) else = errors.map { |node_key, error| "#{node_key}: (#{error.class}) #{error.message}" }.freeze new(.join(', ')).with_errors(errors) end end |
Instance Method Details
#with_errors(errors) ⇒ Object
57 58 59 60 |
# File 'lib/redis_client/cluster/errors.rb', line 57 def with_errors(errors) @errors = errors if @errors.nil? self end |