Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add URI::GID class #17

Closed
wants to merge 1 commit into from
Closed

Add URI::GID class #17

wants to merge 1 commit into from

Conversation

kaspth
Copy link
Contributor

@kaspth kaspth commented Aug 18, 2014

Fixes #6.

I've added methods to extract gid related information and create a conforming uri to URI::GID.

The tests I removed didn't raise a BadURIError because gid:// is now a valid URI.

I copied over the first error message, since Ruby didn't seem to do any validation when parsing.

This error happens because I can't figure how to get it to parse the path on creation:

  1) Error:
GlobalLocatorTest#test_by_invalid_GID_URI_returns_nil:
NameError: wrong constant name 1
    /Users/kasperhansen/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:238:in `const_get'
    /Users/kasperhansen/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:238:in `block in constantize'
    /Users/kasperhansen/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `each'
    /Users/kasperhansen/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `inject'
    /Users/kasperhansen/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `constantize'
    /Users/kasperhansen/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
    /Users/kasperhansen/Documents/code/globalid/lib/global_id/global_id.rb:38:in `model_class'
    /Users/kasperhansen/Documents/code/globalid/lib/global_id/global_id.rb:34:in `find'
    /Users/kasperhansen/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/core_ext/object/try.rb:45:in `public_send'
    /Users/kasperhansen/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/core_ext/object/try.rb:45:in `try'
    /Users/kasperhansen/Documents/code/globalid/lib/global_id/global_id.rb:17:in `find'
    /Users/kasperhansen/Documents/code/globalid/lib/global_id/locator.rb:6:in `locate'
    /Users/kasperhansen/Documents/code/globalid/test/cases/global_locator_test.rb:44:in `block in <class:GlobalLocatorTest>'

@jeremy
Copy link
Member

jeremy commented Aug 18, 2014

Ruby URI::Generic has a separate arg_check option to #initialize that decides whether to immediately validate the URI.

@jeremy
Copy link
Member

jeremy commented Aug 18, 2014

Thanks @kaspth ! @sebasoga has made progress at #18, so let's proceed there ❤️

@jeremy jeremy closed this Aug 18, 2014
@kaspth
Copy link
Contributor Author

kaspth commented Aug 18, 2014

Sweet!

Den 18/08/2014 kl. 16.17 skrev Jeremy Kemper [email protected]:

Thanks @kaspth ! @sebasoga has made progress at #18, so let's proceed there


Reply to this email directly or view it on GitHub.

Kasper

@kaspth kaspth deleted the uri-gid branch August 18, 2014 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specialize our URI class rather than leaning on Ruby's URI::Generic as a URL
2 participants