Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Wrap strings to act like in 1.9

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 VERSION
Octocat-spinner-32 string19.gemspec
Readme.md

Stop thinking about differences between 1.9 and 1.8.

size / index / slice / slice! / chars / bytes / [] etc supported

Still some methods missing, fork & pull for what you need!

Install

sudo gem install string19

Usage

# on 1.8 AND 1.9
String19("Á§ÐÁ§Ð").size == 6

# to add a new wrapped method (result is a String19)
class String
  def foo
    'fäää'
  end
end

String19::Wrapped.wrap(:foo) if String19::IS_18
String19('').foo.size == 4

# to add a new delegated method (result is not modified)
class String
  def foo
    42
  end
end

String19::Wrapped.delegate(:foo) if String19::IS_18

String19('').foo == 42

Author

Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...

Something went wrong with that request. Please try again.