Skip to content

Conversation

@ashmaroli
Copy link
Member

  • API_SCAFFOLD is the base hash with each key pointing to a nil value. When merged with the API generated via calling #hash_for_api, the values of the base API will get updated. Therefore, the first two keys of the final api hash from calling #to_api will always be "name" and "path".
    The url fields ("http_url", "api_url", and collections' "entries_url") are injected towards the end so that they are always the last keys of the api hash.
  • Use Hash#merge! for subsequent merges to avoid generating a new Hash object unnecessarily.

API_SCAFFOLD is the base hash with each key pointing to a `nil` value.
When merged with the API generated via calling `#hash_for_api`, the
values of the base API will get updated. Therefore, the first two keys
of the final api hash from calling `#to_api` will always be "name" and
"path".

The url fields ("http_url", "api_url", and collections' "entries_url")
are injected towards the end so that they are always the last keys of
the api hash.
@ashmaroli ashmaroli merged commit ea59fb5 into jekyll:master Nov 11, 2019
@ashmaroli ashmaroli deleted the optimize-api-hashes branch November 11, 2019 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants