You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::AsyncClientStubs::StubStream

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-core/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



53
54
55
# File 'gems/aws-sdk-core/lib/aws-sdk-core/async_client_stubs.rb', line 53

def initialize
  @state = :open
end

Instance Attribute Details

#send_eventsObject

Returns the value of attribute send_events



57
58
59
# File 'gems/aws-sdk-core/lib/aws-sdk-core/async_client_stubs.rb', line 57

def send_events
  @send_events
end

#stateObject (readonly)

Returns the value of attribute state



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

def state
  @state
end

Instance Method Details

#closeObject



75
76
77
# File 'gems/aws-sdk-core/lib/aws-sdk-core/async_client_stubs.rb', line 75

def close
  @state = :closed
end

#closed?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'gems/aws-sdk-core/lib/aws-sdk-core/async_client_stubs.rb', line 71

def closed?
  @state == :closed
end

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



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

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