-
Notifications
You must be signed in to change notification settings - Fork 6
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
Refactor polish and weld #224
Conversation
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.
Nice - I like the approach!
Welds.load!(self) | ||
@welds = Welds.for(model) | ||
Polishes.load!(self) | ||
@polishes = Polishes.for(model) | ||
|
||
@welds.each { |weld| weld.preprocess(model) } | ||
@model = Vise::Model.new(model) |
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.
Nice! I like this.
|
||
module Smithy | ||
# @api private | ||
module Polishes |
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.
Naming discussion. Polishes
reads a little weirdly to me - it almost feels like this should be Polishers
. Ie, a Polisher
can take the polish
action, eg: @polishers.each { |p| p.polish }
.
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.
Polishes is the plural of polish. We can think about changing this.
def smith(plan) | ||
artifact = Smithy::Forge.forge(plan) | ||
Smithy::Polish.descendants.each { |p| p.new(plan).polish(artifact) } | ||
plan.polishes.each { |polish| polish.polish(artifact) } |
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.
I'm struggling a little bit with why we have separate Welds and Polishes. Why are these separate extension points - couldn't "polish" just be a hook on a weld?
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.
Polish required instances because it uses Thor actions. Weld now has instances but doesn't include thor. I'm not sure if we should keep the distinction anymore or not.
Pulls model out of plan, so that polish and welding can accept plan, and at various steps, would not have incomplete models or mismatched types.