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

Eagerly coerce facet values to strings coming out of FacetItemPresenter#label #2623

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

cbeer
Copy link
Member

@cbeer cbeer commented Feb 15, 2022

This should make for fewer surprises with downstream code expecting strings. The value method provides the original value.

The return value of label is used in two places within Blacklight, which expect (and required) a string value:

https://github.com/projectblacklight/blacklight/blob/main/app/components/blacklight/constraint_layout_component.html.erb#L4
https://github.com/projectblacklight/blacklight/blob/main/app/components/blacklight/facet_item_component.rb#L41

This should allow downstream consumers that are working with domain-specific classes (e.g. geoblacklight and Geoblacklight::BoundingBox) to just implement #to_s on their object and get reasonable out-of-the-box behavior without much trouble.

@cbeer cbeer changed the title Coerce facet values to strings Coerce facet values to strings coming out of FacetItemPresenter#label Feb 15, 2022
@cbeer cbeer changed the title Coerce facet values to strings coming out of FacetItemPresenter#label Eagerly Coerce facet values to strings coming out of FacetItemPresenter#label Feb 15, 2022
@cbeer cbeer changed the title Eagerly Coerce facet values to strings coming out of FacetItemPresenter#label Eagerly coerce facet values to strings coming out of FacetItemPresenter#label Feb 15, 2022
@cbeer cbeer marked this pull request as ready for review February 15, 2022 22:49
@jcoyne jcoyne merged commit e34e534 into main Mar 16, 2022
@jcoyne jcoyne deleted the cbeer-patch-1 branch March 16, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants