diff options
Diffstat (limited to 'guides/rails_guides/kindle.rb')
-rw-r--r-- | guides/rails_guides/kindle.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/guides/rails_guides/kindle.rb b/guides/rails_guides/kindle.rb index 9536d0bd3b..8a0361ff4c 100644 --- a/guides/rails_guides/kindle.rb +++ b/guides/rails_guides/kindle.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require "kindlerb" require "nokogiri" @@ -34,7 +35,7 @@ module Kindle def generate_front_matter(html_pages) frontmatter = [] html_pages.delete_if { |x| - if x =~ /(toc|welcome|credits|copyright).html/ + if /(toc|welcome|copyright).html/.match?(x) frontmatter << x unless x =~ /toc/ true end @@ -57,9 +58,9 @@ module Kindle end def generate_sections(html_pages) - FileUtils::rm_rf("sections/") + FileUtils.rm_rf("sections/") html_pages.each_with_index do |page, section_idx| - FileUtils::mkdir_p("sections/%03d" % section_idx) + FileUtils.mkdir_p("sections/%03d" % section_idx) doc = Nokogiri::HTML(File.open(page)) title = doc.at("title").inner_text.gsub("Ruby on Rails Guides: ", "") title = page.capitalize.gsub(".html", "") if title.strip == "" |