Skip to content

Commit

Permalink
Merge pull request grpc#7270 from kpayson64/ruby_ga_change
Browse files Browse the repository at this point in the history
Change cancelled to cancelled?
  • Loading branch information
kpayson64 authored Jul 8, 2016
2 parents e705dc4 + b156671 commit 34967b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/ruby/lib/grpc/generic/active_call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def output_metadata
end

# cancelled indicates if the call was cancelled
def cancelled
def cancelled?
!@call.status.nil? && @call.status.code == Core::StatusCodes::CANCELLED
end

Expand Down Expand Up @@ -455,17 +455,17 @@ def initialize(wrapped)

# SingleReqView limits access to an ActiveCall's methods for use in server
# handlers that receive just one request.
SingleReqView = view_class(:cancelled, :deadline, :metadata,
SingleReqView = view_class(:cancelled?, :deadline, :metadata,
:output_metadata, :peer, :peer_cert)

# MultiReqView limits access to an ActiveCall's methods for use in
# 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)

# Operation limits access to an ActiveCall's methods for use as
# 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,
:write_flag=)
end
Expand Down
4 changes: 2 additions & 2 deletions src/ruby/pb/test/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def cancel_after_begin
op.execute
fail 'Should have raised GRPC:Cancelled'
rescue GRPC::Cancelled
assert("#{__callee__}: call operation should be CANCELLED") { op.cancelled }
assert("#{__callee__}: call operation should be CANCELLED") { op.cancelled? }
end

def cancel_after_first_response
Expand All @@ -380,7 +380,7 @@ def cancel_after_first_response
op.execute.each { |r| ppp.queue.push(r) }
fail 'Should have raised 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
end

Expand Down
4 changes: 2 additions & 2 deletions src/ruby/spec/generic/active_call_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

describe '#multi_req_view' 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
want.each do |w|
expect(v.methods.include?(w))
Expand All @@ -71,7 +71,7 @@

describe '#single_req_view' 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
want.each do |w|
expect(v.methods.include?(w))
Expand Down

0 comments on commit 34967b7

Please sign in to comment.