-
Notifications
You must be signed in to change notification settings - Fork 1
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
Transformations #14
Transformations #14
Conversation
# | ||
# @return [SkoogleDocs::Transformer] | ||
def transformer | ||
SkoogleDocs::Transformer.new(@source) |
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.
so, I can't overwrite? What about using mocks in tests?
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 agree with @ruprict, here. Maybe we could change this declaration to
def transformer(klass = SkoogleDocs::Transformer)
klass.new(@source)
end
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 agree. Thank you both for giving me input on this. I'll change the code to reflect this.
@chuckpreslar is there a difference between defaulting to an actual instance of SkoogleDocs::Transformer
instead of the class?
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 the class allows for a smaller duck-typed interface the class must implement (only new
here) and more control to allow the transformer
method to function as a factory.
for a hypothetical example, let's say we pass in instances. if the instance we pass it has already been configured with default values, the ability for transformer
to manipulate the instance without potentially breaking things is limited.
Looks really good. I especially like the use of FactoryGirl for the HTML docs. Just had one very minor comment, otherwise |
very nice, @enriikke |
… that responds to rollout
SkoogleDocs::Document
class to use the newSkoogleDocs::Transformer
RSpec
monkey patching