Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gems/smithy-client/lib/smithy-client/dynamic_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def set_error_constant(constant) # rubocop:disable Naming/AccessorMethodName
def error_const_set?(constant)
# Purposefully not using #const_defined? as that method returns true
# for constants not defined directly in the current module.
constants.include?(constant.to_sym)
const_defined?(constant.to_sym)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions gems/smithy-client/lib/smithy-client/net_http/handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def pool_for(config)
# @param [Configuration] config
# @return [Hash]
def pool_options(config)
ConnectionPool::OPTIONS.keys.each_with_object({}) do |opt, opts|
opts[opt] = config.send(opt)
ConnectionPool::OPTIONS.keys.to_h do |opt|
[opt, config.send(opt)]
end
end

Expand Down
2 changes: 1 addition & 1 deletion gems/smithy-client/lib/smithy-client/param_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def add(shape_class, value_class, &block)

def ensure_open(file, converter)
if file.closed?
new_file = File.open(file.path, 'rb')
new_file = File.open(file.path, 'rb') # rubocop:disable Style/FileOpen
converter.opened_files << new_file
new_file
else
Expand Down
15 changes: 8 additions & 7 deletions gems/smithy-client/spec/smithy-client/param_converter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ module Client
end

it 'accepts io objects (like file)' do
file = File.open(__FILE__, 'r')
expect(ParamConverter.c(shape_class, file)).to be(file)
file.close
File.open(__FILE__, 'r') do |file|
expect(ParamConverter.c(shape_class, file)).to be(file)
end
end

it 'accepts io objects (like stringio)' do
Expand All @@ -143,10 +143,11 @@ module Client
end

it 'opens files that are closed' do
file = File.open(__FILE__, 'r')
file.close
converter = ParamConverter.new(nil)
expect(ParamConverter.c(shape_class, file, converter).read).to eq(File.read(__FILE__))
File.open(__FILE__, 'r') do |file|
file.close
converter = ParamConverter.new(nil)
expect(ParamConverter.c(shape_class, file, converter).read).to eq(File.read(__FILE__))
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion gems/smithy/lib/smithy/views/client/operation_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def format(shape_val)
formatted = []
if shape_val.is_a?(Array)
hashes = shape_val.map do |v|
(v.is_a?(Hash) ? format_hash(v, ' ') : v)
v.is_a?(Hash) ? format_hash(v, ' ') : v
end
hashes.join(',')
formatted << hashes
Expand Down
Loading