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

Added short_domains argument to initialize. #189

Merged
merged 1 commit into from
Feb 28, 2022
Merged

Conversation

rhiroe
Copy link
Contributor

@rhiroe rhiroe commented Feb 28, 2022

close: #186

Added short_domains argument to initialize method to accept Boolean.
This is false by default, and if you set it to true, Rinku::AUTOLINK_SHORT_DOMAINS will be set to the flags argument of Rinku.auto_link.
This allows you to autolink short domains.

AutoHtml::Link.new(short_domains: true).call('http://localhost:3000')
#=> "<a href=\"http://localhost:3000\">http://localhost:3000</a>"

The reason for using Boolean is to isolate the behavior for each environment.

AutoHtml::Link.new(short_domains: !Rails.env.production?)

There is no change to the default behavior, so existing projects that use this gem will not be affected.

AutoHtml::Link.new.call('http://localhost:3000')
#=> "http://localhost:3000"

Added short_domains argument to initialize method to accept Booleans.
This is false by default, and if you set it to true, Rinku::AUTOLINK_SHORT_DOMAINS will be set to the flags argument of Rinku.auto_link.
@dejan dejan merged commit 4f47216 into dejan:master Feb 28, 2022
@dejan
Copy link
Owner

dejan commented Feb 28, 2022

@rhiroe thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Want to be able to autolink short domains
2 participants