Class: Aws::AsyncClientStubs::StubStream

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/async_client_stubs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStubStream

Returns a new instance of StubStream.



55
56
57
# File 'lib/aws-sdk-core/async_client_stubs.rb', line 55

def initialize
  @state = :open
end

Instance Attribute Details

#send_eventsObject

Returns the value of attribute send_events.



59
60
61
# File 'lib/aws-sdk-core/async_client_stubs.rb', line 59

def send_events
  @send_events
end

#stateObject (readonly)

Returns the value of attribute state.



61
62
63
# File 'lib/aws-sdk-core/async_client_stubs.rb', line 61

def state
  @state
end

Instance Method Details

#closeObject



77
78
79
# File 'lib/aws-sdk-core/async_client_stubs.rb', line 77

def close
  @state = :closed
end

#closed?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/aws-sdk-core/async_client_stubs.rb', line 73

def closed?
  @state == :closed
end

#data(bytes, options = {}) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/aws-sdk-core/async_client_stubs.rb', line 63

def data(bytes, options = {})
  if options[:end_stream]
    @state = :closed
  else
    decoder = Aws::EventStream::Decoder.new
    event = decoder.decode_chunk(bytes).first
    @send_events << decoder.decode_chunk(event.payload.read).first
  end
end