Actually, yes, you should be able to remove the conditional entirely:

```RUBY
if open_args.last.kind_of?(Hash)
  external = open_args.last[:encoding]
end

string = string.encode(external) if external
```