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

Add comments and escapes to ECR docs #7121

Merged
merged 3 commits into from
Nov 28, 2018
Merged

Conversation

KCErb
Copy link
Contributor

@KCErb KCErb commented Nov 27, 2018

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 phrase Greeting, KC but I believe it is more natural to call the class a Greeter 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 :)

src/ecr.cr Outdated
# Greeting, <%= @name %>!
#
# Greeting.new("John").to_s #=> Greeting, John!
# Greeter.new("John").to_s # => Greetings, John!
Copy link
Member

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!
Copy link
Member

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
Copy link
Member

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")
Copy link
Member

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.

@KCErb
Copy link
Contributor Author

KCErb commented Nov 27, 2018

@straight-shoota Thanks for the comments, I believe I implemented them all correctly.

Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @KCErb 👍

@sdogruyol sdogruyol merged commit 470bbd5 into crystal-lang:master Nov 28, 2018
@sdogruyol sdogruyol added this to the 0.27.1 milestone Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants