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

Remove class methods #4

Closed
wants to merge 12 commits into from
Closed

Remove class methods #4

wants to merge 12 commits into from

Conversation

jnunemaker
Copy link
Contributor

In master, the parser class is responsible for reading a path from disk, parsing it from yaml to ruby, converting all of the patterns into actual ruby regexes, and then finally matching those regexes/patterns to return browser family/version, operating system family/version, and device.

In this branch, the parser is responsible only for matching patterns. I used a file pattern loader which handles the read file, yaml parse, regex conversion and responds to call. The parser then takes an instance of anything that responds to call and returns a hash of patterns/regexes.

  • It removes the need for any class level methods.
  • Each parser instance defaults to a file pattern loader with the vendored ua-parser regexes path.

I added examples for basic usage and custom pattern loader usage. Also updated all readme and such. Should be good to go.

@toolmantim
Copy link
Contributor

Closing this for now in favour of #5

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.

None yet

2 participants