Sha256: dbce9f7c37c8e2bee755a2a35a6cc7af262843f9eebeeb05537cfd17c5724468
Contents?: true
Size: 864 Bytes
Versions: 3
Compression:
Stored size: 864 Bytes
Contents
require 'middleman-robots/group' module Middleman module Robots # Robots Text Generator Class class Generator def initialize(rules, sitemap_uri) @rules = rules @sitemap_uri = sitemap_uri end def process blocks = block_text sitemap = sitemap_text if !blocks.empty? && !sitemap.empty? blocks + "\n" + sitemap elsif !blocks.empty? blocks elsif !sitemap.empty? sitemap else '' end end private def block_text return '' if @rules.empty? data = [] @rules.each do |rule| data << Group.new(rule).text end data.join("\n") end def sitemap_text @sitemap_uri ? "Sitemap: #{@sitemap_uri}" : '' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
middleman-robots-1.3.2 | lib/middleman-robots/generator.rb |
middleman-robots-1.3.1 | lib/middleman-robots/generator.rb |
middleman-robots-1.3.0 | lib/middleman-robots/generator.rb |