-
Notifications
You must be signed in to change notification settings - Fork 3
refact: Clarify belong_to_segment
algorithm
#118
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
Conversation
Signed-off-by: Javier G. Sogo <[email protected]>
Signed-off-by: Javier G. Sogo <[email protected]>
/// * the entity contains the requested attribute, AND | ||
/// * the entity attribute satisfies ANY of the rule values. | ||
/// | ||
/// TODO: What if rules.values is empty? Now it returns false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is fine as a corner-case. A rule with no values does not make much sense. Maybe in the future we get some cross-client tests to ensure that all clients behave the same here xD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
entity | ||
.get_attributes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I forgot to mention this here:
This get_attributes
is returning a HashMap
(note no reference), so here it will creating a new map for every Rule
. I don't like this. Maybe we should return here a reference and it's up to the user to pass an Entity
that doesn't generate the map again and again. Wdyt?
…gment Signed-off-by: Javier G. Sogo <[email protected]>
…efact/belong_to_segment
Signed-off-by: Travis <[email protected]>
Signed-off-by: Travis <[email protected]>
Signed-off-by: Travis <[email protected]>
82e072f
to
122c0c2
Compare
MatchesEntity
trait that is implemented forSegment
andRule
so we can isolate the logic that applies to each one of them when matching an entity.