Change cancelled to cancelled?

pull/7270/head
Ken Payson 9 years ago
parent 2cbe754285
commit b156671023
  1. 8
      src/ruby/lib/grpc/generic/active_call.rb
  2. 4
      src/ruby/pb/test/client.rb
  3. 4
      src/ruby/spec/generic/active_call_spec.rb

@ -120,7 +120,7 @@ module GRPC
end end
# cancelled indicates if the call was cancelled # cancelled indicates if the call was cancelled
def cancelled def cancelled?
!@call.status.nil? && @call.status.code == Core::StatusCodes::CANCELLED !@call.status.nil? && @call.status.code == Core::StatusCodes::CANCELLED
end end
@ -455,17 +455,17 @@ module GRPC
# SingleReqView limits access to an ActiveCall's methods for use in server # SingleReqView limits access to an ActiveCall's methods for use in server
# handlers that receive just one request. # handlers that receive just one request.
SingleReqView = view_class(:cancelled, :deadline, :metadata, SingleReqView = view_class(:cancelled?, :deadline, :metadata,
:output_metadata, :peer, :peer_cert) :output_metadata, :peer, :peer_cert)
# MultiReqView limits access to an ActiveCall's methods for use in # MultiReqView limits access to an ActiveCall's methods for use in
# server client_streamer handlers. # server client_streamer handlers.
MultiReqView = view_class(:cancelled, :deadline, :each_queued_msg, MultiReqView = view_class(:cancelled?, :deadline, :each_queued_msg,
:each_remote_read, :metadata, :output_metadata) :each_remote_read, :metadata, :output_metadata)
# Operation limits access to an ActiveCall's methods for use as # Operation limits access to an ActiveCall's methods for use as
# a Operation on the client. # a Operation on the client.
Operation = view_class(:cancel, :cancelled, :deadline, :execute, Operation = view_class(:cancel, :cancelled?, :deadline, :execute,
:metadata, :status, :start_call, :wait, :write_flag, :metadata, :status, :start_call, :wait, :write_flag,
:write_flag=) :write_flag=)
end end

@ -369,7 +369,7 @@ class NamedTests
op.execute op.execute
fail 'Should have raised GRPC:Cancelled' fail 'Should have raised GRPC:Cancelled'
rescue GRPC::Cancelled rescue GRPC::Cancelled
assert("#{__callee__}: call operation should be CANCELLED") { op.cancelled } assert("#{__callee__}: call operation should be CANCELLED") { op.cancelled? }
end end
def cancel_after_first_response def cancel_after_first_response
@ -380,7 +380,7 @@ class NamedTests
op.execute.each { |r| ppp.queue.push(r) } op.execute.each { |r| ppp.queue.push(r) }
fail 'Should have raised GRPC:Cancelled' fail 'Should have raised GRPC:Cancelled'
rescue GRPC::Cancelled rescue GRPC::Cancelled
assert("#{__callee__}: call operation should be CANCELLED") { op.cancelled } assert("#{__callee__}: call operation should be CANCELLED") { op.cancelled? }
op.wait op.wait
end end

@ -61,7 +61,7 @@ describe GRPC::ActiveCall do
describe '#multi_req_view' do describe '#multi_req_view' do
it 'exposes a fixed subset of the ActiveCall methods' do it 'exposes a fixed subset of the ActiveCall methods' do
want = %w(cancelled, deadline, each_remote_read, metadata, shutdown) want = %w(cancelled?, deadline, each_remote_read, metadata, shutdown)
v = @client_call.multi_req_view v = @client_call.multi_req_view
want.each do |w| want.each do |w|
expect(v.methods.include?(w)) expect(v.methods.include?(w))
@ -71,7 +71,7 @@ describe GRPC::ActiveCall do
describe '#single_req_view' do describe '#single_req_view' do
it 'exposes a fixed subset of the ActiveCall methods' do it 'exposes a fixed subset of the ActiveCall methods' do
want = %w(cancelled, deadline, metadata, shutdown) want = %w(cancelled?, deadline, metadata, shutdown)
v = @client_call.single_req_view v = @client_call.single_req_view
want.each do |w| want.each do |w|
expect(v.methods.include?(w)) expect(v.methods.include?(w))

Loading…
Cancel
Save