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

Allow creation of Pattern from Symbol #1247

Merged
merged 1 commit into from Nov 16, 2017
Merged

Conversation

@gpakosz
Copy link
Member

@gpakosz 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

@gpakosz gpakosz force-pushed the pattern-from-symbol branch from 0128688 to ec8ec14 Nov 15, 2017
@ddfreyne
Copy link
Member

@ddfreyne 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.

Loading

@gpakosz
Copy link
Member Author

@gpakosz gpakosz commented Nov 16, 2017

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

🤔

Loading

@ddfreyne
Copy link
Member

@ddfreyne ddfreyne commented Nov 16, 2017

Whoops! I meant:

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

Loading

@gpakosz
Copy link
Member Author

@gpakosz 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.

Loading

@ddfreyne
Copy link
Member

@ddfreyne 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.

Loading

@ddfreyne ddfreyne merged commit 37da46f into nanoc:master Nov 16, 2017
1 check passed
Loading
@gpakosz
Copy link
Member Author

@gpakosz gpakosz commented Nov 16, 2017

OH! You merged fast.

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

Loading

@gpakosz gpakosz deleted the 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
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants