diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:39:28 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:39:28 +0200 |
commit | 1607ee299d15c133b2b63dcfc840eddfba7e525b (patch) | |
tree | f1d045de895e4488c95553262a991e62d89756e3 /guides/rails_guides | |
parent | 477568ee33bee0dc5e57b9df624142296e3951a4 (diff) | |
download | rails-1607ee299d15c133b2b63dcfc840eddfba7e525b.tar.gz rails-1607ee299d15c133b2b63dcfc840eddfba7e525b.tar.bz2 rails-1607ee299d15c133b2b63dcfc840eddfba7e525b.zip |
modernizes hash syntax in guides
Diffstat (limited to 'guides/rails_guides')
-rw-r--r-- | guides/rails_guides/generator.rb | 4 | ||||
-rw-r--r-- | guides/rails_guides/helpers.rb | 8 | ||||
-rw-r--r-- | guides/rails_guides/indexer.rb | 4 | ||||
-rw-r--r-- | guides/rails_guides/markdown.rb | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/guides/rails_guides/generator.rb b/guides/rails_guides/generator.rb index fdd525a594..881bf2174b 100644 --- a/guides/rails_guides/generator.rb +++ b/guides/rails_guides/generator.rb @@ -194,13 +194,13 @@ module RailsGuides layout = kindle? ? "kindle/layout" : "layout" File.open(output_path, "w") do |f| - view = ActionView::Base.new(source_dir, :edge => @edge, :version => @version, :mobi => "kindle/#{mobi}", :lang => @lang) + view = ActionView::Base.new(source_dir, edge: @edge, version: @version, mobi: "kindle/#{mobi}", lang: @lang) view.extend(Helpers) if guide =~ /\.(\w+)\.erb$/ # Generate the special pages like the home. # Passing a template handler in the template name is deprecated. So pass the file name without the extension. - result = view.render(:layout => layout, :formats => [$1], :file => $`) + result = view.render(layout: layout, formats: [$1], file: $`) else body = File.read(File.join(source_dir, guide)) result = RailsGuides::Markdown.new(view, layout).render(body) diff --git a/guides/rails_guides/helpers.rb b/guides/rails_guides/helpers.rb index 4dd7bf4def..c7d3a38ba9 100644 --- a/guides/rails_guides/helpers.rb +++ b/guides/rails_guides/helpers.rb @@ -3,11 +3,11 @@ require "yaml" module RailsGuides module Helpers def guide(name, url, options = {}, &block) - link = content_tag(:a, :href => url) { name } + link = content_tag(:a, href: url) { name } result = content_tag(:dt, link) if options[:work_in_progress] - result << content_tag(:dd, "Work in progress", :class => "work-in-progress") + result << content_tag(:dd, "Work in progress", class: "work-in-progress") end result << content_tag(:dd, capture(&block)) @@ -39,10 +39,10 @@ module RailsGuides def author(name, nick, image = "credits_pic_blank.gif", &block) image = "images/#{image}" - result = tag(:img, :src => image, :class => "left pic", :alt => name, :width => 91, :height => 91) + result = tag(:img, src: image, class: "left pic", alt: name, width: 91, height: 91) result << content_tag(:h3, name) result << content_tag(:p, capture(&block)) - content_tag(:div, result, :class => "clearfix", :id => nick) + content_tag(:div, result, class: "clearfix", id: nick) end def code(&block) diff --git a/guides/rails_guides/indexer.rb b/guides/rails_guides/indexer.rb index be1c3fab80..1550ceedac 100644 --- a/guides/rails_guides/indexer.rb +++ b/guides/rails_guides/indexer.rb @@ -39,8 +39,8 @@ module RailsGuides raise "Parsing Fail" unless @result.sub!(matched, "h#{level}(#{idx}). #{index} #{title}") key = { - :title => title, - :id => idx + title: title, + id: idx } # Recurse counters << 1 diff --git a/guides/rails_guides/markdown.rb b/guides/rails_guides/markdown.rb index 6c44353b3b..6037016f12 100644 --- a/guides/rails_guides/markdown.rb +++ b/guides/rails_guides/markdown.rb @@ -159,7 +159,7 @@ module RailsGuides @view.content_for(:header_section) { @header } @view.content_for(:page_title) { @title } @view.content_for(:index_section) { @index } - @view.render(:layout => @layout, :text => @body) + @view.render(layout: @layout, text: @body) end end end |