Sha256: fe11c7fdb2d80457e0fd0b937f04f5fb10b4a3ea6d783d2512c922d6198e62b8

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

require 'middleman-robots/generators/blocks'
require 'middleman-robots/generators/sitemap_uri'

module Middleman
  module Robots
    # Robots Text Generator Class
    class Generator
      attr_accessor :rules, :sitemap_uri

      def initialize(rules, sitemap_uri)
        @rules = rules
        @sitemap_uri = sitemap_uri
      end

      def process
        text = [
          Generators::Blocks.new(rules).text,
          Generators::SitemapUri.new(sitemap_uri).text
        ].compact.join "\n\n"

        text += "\n" if text.present?
        text
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
middleman-robots-1.3.7 lib/middleman-robots/generator.rb
middleman-robots-1.3.6 lib/middleman-robots/generator.rb
middleman-robots-1.3.5 lib/middleman-robots/generator.rb