-
Notifications
You must be signed in to change notification settings - Fork 90
Refactor renderers #34
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
Conversation
|
Nice. Thanks, @ttaylorr. I'll pull this down and test it out when I get chance (hopefully this week, but I'll be traveling for Thanksgiving a bit). Since this is all cleanup and refactoring (and no new functionality), let's go with bumping the version to |
|
Sure, that sounds 🆒 to me. Still a few things left before this is ready to be tested. I'll remove the "[WIP]" from the title once we're good to go. |
a3a6df6 to
d3853fe
Compare
|
Did a smoke test locally and everything seems to be 👍. Feel free to take a look yourself and merge away. /to @jasonlong |
|
@ttaylorr I didn't notice until just now that this breaks the current syntax for specifying a pattern.
vs.
I definitely want to keep this backwards compatible with what's in place now. I didn't dive too deeply into your restructuring, but I fear this might be a big monkey wrench. 😬 |
|
Yeah, this is why I initially was going for a version bump to To be fair though, I think breaking that old behavior might actually be a win here. Seems much clearer to me that we pass class names instead of strings to |
|
TBH I prefer the simplicity of a string like |
|
IMHO I prefer the |
README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my OCD you would mind changing the line to look like this?
<div style="background-image: <%= pattern.uri_image %>"></div>There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
The interface @ttaylorr proposed would work well from the perspective of the JS port. GeoPattern.generate('GitHub', { generator: GeoPattern.SineWavePattern });
In general I think the proposed interface does a good job of improving discoverability compared to using strings. If I were to do this in the JS port, I'd do a minor version bump to 1.3 due to the new API, but I'd maintain backwards compatibility until a hypothetical 2.0 by having the |
|
Well alrighty, you guys have convinced me. Let's do this. 🚀 I agree that this warrants a bump to 1.3.0. @ttaylorr, would you be able add support for the current string syntax and possibly a deprecation warning for those still using that syntax? |
|
Glad you agree, @jasonlong - thanks for having others weight in on this. 👍 I'll bump back to Thanks for the feedback, everybody! |
|
|
|
Thanks @ttaylorr. I'll kick the tires some more shortly and hopefully get this merged. |
lib/geo_pattern/pattern_generator.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using puts here includes this in the generated svg, making it invalid. I think if we just output it like a comment, we'd be 👌. Like <!-- String pattern references are deprecated as of 1.3.0 -->.
|
Sorry @ttaylorr, I've been pretty busy and didn't see you made that change already (which looks good btw). I was testing this out and noticed a problem. I'll add a comment below. |
lib/geo_pattern/pattern_generator.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I use the new :generator => GeoPattern:DiamondsPattern syntax, this always evaluates as false. Strings seem to be working fine. I can investigate, but I need to run out for a bit. If you have time, maybe you could take a peek.
1cc56af to
f3616d8
Compare
lib/geo_pattern/pattern_generator.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ttaylorr, this check still never passes for me when opts[:generator] is something like GeoPattern::ConcentricCirclesPattern. Is it working for you? Wondering if it's a difference w/ Ruby versions.
f3616d8 to
d1e5842
Compare
|
I've forgotten how to Ruby. 😞 |
|
💥 That's better. Also, I was thinking we should be consistent with the plural naming convention. For example, the strings are all plural (e.g. |
|
I think we should opt for the singular form. However, I think patterns with an adjective preceeding the shape should remain as-is: i.e., |
|
🤘 🚀 🚢 |

This pull-request is a bit lengthy, but isn't actually too bad.
Things refactored:
pattern_generatorclasstessellation_pattern.rbandplaid_pattern.rbThis also bumps the version to
1.3.0.