Class: JetstreamBridge::TestHelpers::MockNats::MockStream
- Inherits:
-
Object
- Object
- JetstreamBridge::TestHelpers::MockNats::MockStream
- Defined in:
- lib/jetstream_bridge/test_helpers/mock_nats.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize(name, config) ⇒ MockStream
constructor
A new instance of MockStream.
Constructor Details
#initialize(name, config) ⇒ MockStream
440 441 442 443 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 440 def initialize(name, config) @name = name @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
438 439 440 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 438 def config @config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
438 439 440 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 438 def name @name end |
Instance Method Details
#info ⇒ Object
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/jetstream_bridge/test_helpers/mock_nats.rb', line 445 def info OpenStruct.new( config: OpenStruct.new( name: @name, subjects: @config[:subjects] || [@name], retention: @config[:retention] || 'limits', max_consumers: @config[:max_consumers] || -1, max_msgs: @config[:max_msgs] || -1, max_bytes: @config[:max_bytes] || -1, discard: @config[:discard] || 'old', max_age: @config[:max_age] || 0, max_msgs_per_subject: @config[:max_msgs_per_subject] || -1, max_msg_size: @config[:max_msg_size] || -1, storage: @config[:storage] || 'file', num_replicas: @config[:num_replicas] || 1 ), state: OpenStruct.new( messages: 0, bytes: 0, first_seq: 1, last_seq: 0, consumer_count: 0 ) ) end |