I often want to write something like this:
URI.parse("http://example.com").tap do |uri|
uri.scheme = "https"
end
But I would rather write:
URI.parse("http://example.com").with scheme: 'https'
Add this line to your application's Gemfile:
gem 'iuri'
And then execute:
$ bundle
Or install it yourself as:
$ gem install iuri
uri = IURI.parse "http://example.com"
secure_uri = uri.with scheme: 'https'
- Fork it ( http://github.com//iuri/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