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

Optimize API Hash objects #528

Merged
merged 3 commits into from
Nov 11, 2019
Merged

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