Skip to content

[ruby-2.3 Feature #11785] add encoding: optional argument to String.new#3535

Closed
cheald wants to merge 3 commits intojruby:ruby-2.3from
cheald:string_options
Closed

[ruby-2.3 Feature #11785] add encoding: optional argument to String.new#3535
cheald wants to merge 3 commits intojruby:ruby-2.3from
cheald:string_options

Conversation

@cheald
Copy link
Contributor

@cheald cheald commented Dec 12, 2015

Adds kwargs support to String#initialize such that it will accept an optional :encoding argument.

…g.new`

Adds kwargs support to String#initialize such that it will accept an optional :encoding argument.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure what Java will do here - since it's a final String[], will it be optimized away, or is this going to result in an allocation per invocation? Should this be moved to an array initialized outside of the method?

…ated per invocation. Slightly less typechecking; now behaves similarly to ruby-head when passed invalid types for arg0.
@kares
Copy link
Member

kares commented Dec 13, 2015

picked onto ruby-2.3 with some tunings and maintained initialize compatibility: a3c648d ... thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants