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

Allow creation of Pattern from Symbol #1247

Merged
merged 1 commit into from Nov 16, 2017

Conversation

Projects
None yet
2 participants
@gpakosz
Member

gpakosz commented Nov 15, 2017

A little addition to allow the creation of patterns from symbols, which allows you to write

@items[i]

where i is a Symbol instead of having to mess with #to_s() at the call site

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Nov 16, 2017

Member

I really don’t like this idea, because a symbol semantically isn’t the same as a symbol; generating a pattern from a symbol does not sound right to me. I prefer the #to_s because it’s more explicit.

Member

ddfreyne commented Nov 16, 2017

I really don’t like this idea, because a symbol semantically isn’t the same as a symbol; generating a pattern from a symbol does not sound right to me. I prefer the #to_s because it’s more explicit.

@gpakosz

This comment has been minimized.

Show comment
Hide comment
@gpakosz

gpakosz Nov 16, 2017

Member

because a symbol semantically isn't the same as a symbol

🤔

Member

gpakosz commented Nov 16, 2017

because a symbol semantically isn't the same as a symbol

🤔

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Nov 16, 2017

Member

Whoops! I meant:

… because a symbol semantically isn't the same as a string

Member

ddfreyne commented Nov 16, 2017

Whoops! I meant:

… because a symbol semantically isn't the same as a string

@gpakosz

This comment has been minimized.

Show comment
Hide comment
@gpakosz

gpakosz Nov 16, 2017

Member

… because a symbol semantically isn't the same as a string

I'm not sure I understand what you mean. What prompted me to open this PR is that somewhere in a (partial) layout I'm using information that comes from item metadata or config.

And because of __nanoc_symbolize_keys_recursively, data that started their life as strings in YAML metadata end up being symbols down the road.

Member

gpakosz commented Nov 16, 2017

… because a symbol semantically isn't the same as a string

I'm not sure I understand what you mean. What prompted me to open this PR is that somewhere in a (partial) layout I'm using information that comes from item metadata or config.

And because of __nanoc_symbolize_keys_recursively, data that started their life as strings in YAML metadata end up being symbols down the road.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Nov 16, 2017

Member

Ah yes, I forgot that a config file like

/foo/**/*.md:
  whitelisted: true

/people/**/*.md:
  type: person

… would lead to patterns that are symbols.

Member

ddfreyne commented Nov 16, 2017

Ah yes, I forgot that a config file like

/foo/**/*.md:
  whitelisted: true

/people/**/*.md:
  type: person

… would lead to patterns that are symbols.

@ddfreyne ddfreyne merged commit 37da46f into nanoc:master Nov 16, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@gpakosz

This comment has been minimized.

Show comment
Hide comment
@gpakosz

gpakosz Nov 16, 2017

Member

OH! You merged fast.

I didn't have the impression I was pushing that hard 😅
Thank you!

Member

gpakosz commented Nov 16, 2017

OH! You merged fast.

I didn't have the impression I was pushing that hard 😅
Thank you!

@gpakosz gpakosz deleted the gpakosz:pattern-from-symbol branch Nov 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment