You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
irb(main):001:0> Twingly::URL.parse("//www.url.com")=>#<Twingly::URL:0x3fd8a893c950 //www.url.com>irb(main):002:0> Twingly::URL.parse("//www.url.com").valid?NoMethodError: undefinedmethod`downcase' for nil:NilClass from /Users/robin/Workspace/git/twingly-url/lib/twingly/url.rb:103:in `normalized_scheme' from /Users/robin/Workspace/git/twingly-url/lib/twingly/url.rb:126:in `valid?'from(irb):2from/Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/lib/bundler/cli/console.rb:14:in`run' from /Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/lib/bundler/cli.rb:308:in `console' from /Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'from/Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in`invoke_command' from /Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch' from /Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'from/Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/lib/bundler/cli.rb:10:in`start' from /Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/bin/bundle:20:in `blockin <top(required)>' from /Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/lib/bundler/friendly_errors.rb:7:in `with_friendly_errors'from/Users/robin/.gem/ruby/2.2.3/gems/bundler-1.10.6/bin/bundle:18:in`<top (required)>' from /Users/robin/.gem/ruby/2.2.3/bin/bundle:23:in `load' from /Users/robin/.gem/ruby/2.2.3/bin/bundle:23:in `<main>'
I think we can just switch the order of our if statements
Edit: or not, we need to do something else :)
The text was updated successfully, but these errors were encountered:
There were lots of options to go with there:
* nil check in #scheme or #normalized_scheme
* .to_s in #scheme or #normalized_scheme
* use Addressable’s #normalized_scheme
I don’t think nil checks are that pretty, so that one was quickly
discarded. I also don’t think we should #to_s “randomly” for some
properties it’s either all or nothing in my opinion. Using
Addressable’s own #normalized_scheme was the top candidate, but it did
additional things to the url (not just downcasing it) and I think it’s
a good thing that we try to control what we can when it comes to
normalization.
So ultimately I went with this, I changed so that we check against
#scheme instead of #normalized_scheme as that makes a whole lot of
sense to me at least.
Fix#55.
I think we can just switch the order of our if statements
Edit: or not, we need to do something else :)
The text was updated successfully, but these errors were encountered: