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

All update modes to call to_s + coerce better. #77

Merged
merged 3 commits into from
Sep 5, 2018

Conversation

guyboertje
Copy link

Align with upcoming PR #75

Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/

Align with upcoming PR logstash-plugins#75

Bump CHANGELOG to 3.2.3
@jsvd jsvd self-requested a review September 5, 2018 10:19
end

def test_for_inclusion(event, override)
# Skip translation in case @destination iterate_on already exists and @override is disabled.
return false if event.include?(@destination) && !override
return false if !override && event.include?(@destination)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its better to check the boolean before making the more expensive include? call, no?

@@ -25,7 +25,7 @@ def update(event)
inner = event.get(nested_field)
next if inner.nil?
matched = [true, nil]
@lookup.fetch_strategy.fetch(inner, matched)
@lookup.fetch_strategy.fetch(inner.to_s, matched)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes should be accompanied by a couple of tests, maybe? like showing how integer keys get coerced in to strings and an array gets coerced into its first element

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do.

CHANGELOG.md Outdated
@@ -1,4 +1,5 @@
## master
## 3.2.3
- Fix to align with docs - looked-up values are always strings. Coerce better.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please link to pr here

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a minor note to include pr link in changelog

@guyboertje guyboertje merged commit f9b3ded into logstash-plugins:master Sep 5, 2018
@guyboertje guyboertje deleted the fix/to_s-coerce branch September 5, 2018 12:57
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.

2 participants