Class: Messaging::Adapters::Test::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/messaging/adapters/test/stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Stream

Returns a new instance of Stream.



7
8
9
# File 'lib/messaging/adapters/test/stream.rb', line 7

def initialize(name)
  self.name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/messaging/adapters/test/stream.rb', line 5

def name
  @name
end

Instance Method Details

#current_positionObject



19
20
21
# File 'lib/messaging/adapters/test/stream.rb', line 19

def current_position
  messages.length - 1
end

#messagesObject



11
12
13
# File 'lib/messaging/adapters/test/stream.rb', line 11

def messages
  @messages ||= []
end

#to_sObject



15
16
17
# File 'lib/messaging/adapters/test/stream.rb', line 15

def to_s
  name
end