diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-02-09 23:13:41 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-02-09 23:13:41 -0300 |
commit | f04a49b033e3da54a52f76289863ec87a3c30438 (patch) | |
tree | aaa50a05eeed0c9d0b13c56eefba2f1a2d987840 /guides/rails_guides | |
parent | e04de27b2fb0dffdf54316c42bc9669023877d51 (diff) | |
download | rails-f04a49b033e3da54a52f76289863ec87a3c30438.tar.gz rails-f04a49b033e3da54a52f76289863ec87a3c30438.tar.bz2 rails-f04a49b033e3da54a52f76289863ec87a3c30438.zip |
Fix rubocop violations
Diffstat (limited to 'guides/rails_guides')
-rw-r--r-- | guides/rails_guides/markdown/renderer.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/guides/rails_guides/markdown/renderer.rb b/guides/rails_guides/markdown/renderer.rb index 97df6f0559..8723ee0b4e 100644 --- a/guides/rails_guides/markdown/renderer.rb +++ b/guides/rails_guides/markdown/renderer.rb @@ -16,7 +16,7 @@ HTML end def link(url, title, content) - if url.start_with?('http://api.rubyonrails.org') + if url.start_with?("http://api.rubyonrails.org") %(<a href="#{api_link(url)}">#{content}</a>) elsif title %(<a href="#{url}" title="#{title}">#{content}</a>) @@ -93,29 +93,29 @@ HTML end def github_file_url(file_path) - root, rest = file_path.split('/', 2) + root, rest = file_path.split("/", 2) case root - when 'abstract_controller', 'action_controller', 'action_dispatch' - path = ['actionpack', 'lib', root, rest].join('/') - when 'active_support', 'active_record', 'active_model', 'action_view', - 'action_cable', 'action_mailer', 'action_pack', 'active_job' - path = [root.sub('_', ''), 'lib', root, rest].join('/') + when "abstract_controller", "action_controller", "action_dispatch" + path = ["actionpack", "lib", root, rest].join("/") + when "active_support", "active_record", "active_model", "action_view", + "action_cable", "action_mailer", "action_pack", "active_job" + path = [root.sub("_", ""), "lib", root, rest].join("/") else path = file_path end - ["https://github.com/rails/rails/tree", version || 'master', path].join('/') + ["https://github.com/rails/rails/tree", version || "master", path].join("/") end def version - ENV['RAILS_VERSION'] + ENV["RAILS_VERSION"] end def api_link(url) if version && !url.match(/v\d\.\d\.\d/) - url.insert(url.index('.org')+4, "/#{version}") - url.sub('http://edgeapi', 'http://api') if url.include?('edgeapi') + url.insert(url.index(".org") + 4, "/#{version}") + url.sub("http://edgeapi", "http://api") if url.include?("edgeapi") end url |