Skip to content

Match resources of unregistered types in getresources - #152

Open
stephanmoneybird wants to merge 1 commit into
ruby:masterfrom
stephanmoneybird:extract-resources-generic-types
Open

stephanmoneybird wants to merge 1 commit into
ruby:masterfrom
stephanmoneybird:extract-resources-generic-types

Conversation

@stephanmoneybird

Copy link
Copy Markdown

Fixes #151.

Since fa5e689, Generic.create does not register its class, so decoding a reply gives each resource of an unregistered type a new class. extract_resources selected answers with when typeclass, which compares the class itself. So getresources and each_resource returned nothing for types that have no named class, for example NAPTR.

This change keeps the identity check and adds a comparison by type and class value, with Generic.type_class_equal?. Message#== and Generic#== already use this method since 05185b4. Named types behave as before: type_class_equal? returns false when a class is not a Generic.

The new test fails without the change. The full suite passes.

Since fa5e689 a class from Generic.create is not registered, so decoding
a reply gives every resource of that type a fresh class. extract_resources
compared by class identity and dropped all of them, so getresources and
each_resource returned nothing for types without a named class, such as
NAPTR. Compare by type and class value as Message#== already does.

Fixes ruby#151

This branch has not been deployed

No deployments
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.

getresources returns nothing for types created with Generic.create since 0.7.2

1 participant