Skip to content

Comments

deal with nils in collection lists#140

Merged
josler merged 1 commit intomasterfrom
jo/parse-collections-with-nil-lists
Jan 19, 2015
Merged

deal with nils in collection lists#140
josler merged 1 commit intomasterfrom
jo/parse-collections-with-nil-lists

Conversation

@josler
Copy link
Contributor

@josler josler commented Jan 19, 2015

Fixes #139

Copy link
Contributor

Choose a reason for hiding this comment

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

lgtm, wondering if this is hiding an error (ie, is nil a reasonable value to end up with)?

josler added a commit that referenced this pull request Jan 19, 2015
@josler josler merged commit a99fa07 into master Jan 19, 2015
Copy link
Contributor

Choose a reason for hiding this comment

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

nil.to_a is [] in ruby, so alternatively you could use:

def deserialize_collection(collection_json)
  collection_json.to_a
    .map { |item_json| TypedJsonDeserializer.new(item_json).deserialize }
end

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.

parsing notification payload with nil values for lists fails

3 participants