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 parents and lineage methods #173

Open
doriantaylor opened this issue Aug 9, 2023 · 1 comment · May be fixed by #175
Open

add parents and lineage methods #173

doriantaylor opened this issue Aug 9, 2023 · 1 comment · May be fixed by #175

Comments

@doriantaylor
Copy link

doriantaylor commented Aug 9, 2023

I have a subclass of MimeMagic that I use that has a handful of useful methods:

  • .binary? will sample an input to determine if it's binary (or text)
  • .default_type will return application/octet-stream if the input is binary, text/plain otherwise
  • #parents will return the list of a type's immediate parents
  • #lineage will return a type's full list of ancestors

I also make a cursory affordance for type parameters in the constructor and inspect methods.

I'm filing this issue rather than coming in hot with a PR because I also change the behaviour of .by_magic and .all_by_magic, such that they will always return a value (the value of .default_type); I figured that merited some discussion. I'm happy to do the patch that addresses this and another issue.

@doriantaylor doriantaylor linked a pull request Aug 10, 2023 that will close this issue
@doriantaylor
Copy link
Author

Update: I did the patch.

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 a pull request may close this issue.

1 participant