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 undef values from the tags array #245

Closed
wants to merge 1 commit into from

Conversation

dsolsona
Copy link

Two minor fixes:

raise Exception("") doesn't seem to work in ruby 1.9 or 2.x but raise Exception.new('') does

irb(main):003:0> raise Exception("Unable to handle object of type <%s>" % obj.class.to_s)
NoMethodError: undefined method `Exception' for main:Object
    from (irb):3

irb(main):004:0> raise Exception.new("Unable to handle object of type <%s>" % obj.class.to_s)
Exception: Unable to handle object of type <String>
    from (irb):4

The second fix happens when you pass an undef inside the $tags variable. This causes consul_sorted_json to throw an exception. delete_undef_values doesn't seem to be able to remove the undef from the tags array inside the $basic_hash hash.

Explicitly running delete_undef_values on the tags fixes the issue.

@hopperd
Copy link
Contributor

hopperd commented Mar 23, 2016

Could we get a test added for this case?

@mcasper
Copy link
Contributor

mcasper commented Jun 4, 2016

@dsolsona For your second problem, what you're actually running into are nested :undef values, the function currently only takes care of top level :undefs. See #263

@solarkennedy
Copy link
Contributor

Closing. Thanks again @mcasper.

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.

4 participants