-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add comments and escapes to ECR docs #7121
Conversation
src/ecr.cr
Outdated
# Greeting, <%= @name %>! | ||
# | ||
# Greeting.new("John").to_s #=> Greeting, John! | ||
# Greeter.new("John").to_s # => Greetings, John! |
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.
Could you wrap the result in quotes?
src/ecr.cr
Outdated
# | ||
# Greeting.new(nil).to_s #=> Greeting! | ||
# Greeter.new(nil).to_s # => Greetings! |
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.
Ditto: quotes.
And maybe add a usage example with a name?
src/ecr.cr
Outdated
# <%- @names.each do |name| -%> | ||
# Hi, <%= name %>! | ||
# <%- end -%> | ||
# Greeter.new("John", "Zoe", "Ben").to_s |
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.
# => "Hi, John!\nHi, Zoe!\nHi, Ben!"
src/ecr.cr
Outdated
# ``` | ||
# require "ecr" | ||
# foo = 2 | ||
# string = ECR.render("demo.ecr") |
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.
There is no need for storing the result in a variable, just directly show the result. .inspect
is not essential, either.
@straight-shoota Thanks for the comments, I believe I implemented them all correctly. |
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.
Looks good!
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.
Thank you @KCErb 👍
PR #2004 added some new features to ECR, here are the docs to go with them.
Also, I felt like the language was a little awkward in the examples. Originally the class:
Greeting
would greet a user with the phraseGreeting, KC
but I believe it is more natural to call the class aGreeter
and I'm sure (as a native English speaker) that the idiom is "Greetings, KC".Sorry if that kind of input isn't welcome, I don't mean to be pedantic. I'm happy to revert that aspect of this PR if requested :)