Create a String with a given capacity with StringBuffer.new(capacity)
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install string_buffer
Use StringBuffer.new to create a buffer with the given capacity
irb> str = StringBuffer.new(1000) => ""
Use StringBuffer.capacity get the current string capacity.
irb> StringBuffer.capacity(str) => 1000
StringBuffer.capacity works with any String.
irb> StringBuffer.capacity("") => 23
- Fork it ( http://github.com/dylanahsmith/ruby-string-buffer/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request