Sha256: 5cbe5231d1ef7835476e69b1e2245d109b00debc03244ac2d467e17f792d5cf3

Contents?: true

Size: 775 Bytes

Versions: 9

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

module Riddle
  class Configuration
    class TemplateIndex < Riddle::Configuration::Section
      include Riddle::Configuration::IndexSettings

      def self.settings
        Riddle::Configuration::IndexSettings.settings
      end

      attr_accessor :parent

      def initialize(name)
        @name = name
        @type = 'template'

        initialize_settings
      end

      def render
        raise ConfigurationError, "#{@name} #{@parent}" unless valid?

        inherited_name = "#{name}"
        inherited_name << " : #{parent}" if parent
        (
          ["index #{inherited_name}", "{"] +
          settings_body +
          ["}", ""]
        ).join("\n")
      end

      def valid?
        @name
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
riddle-2.4.3 lib/riddle/configuration/template_index.rb
riddle-2.4.2 lib/riddle/configuration/template_index.rb
riddle-2.4.1 lib/riddle/configuration/template_index.rb
riddle-2.4.0 lib/riddle/configuration/template_index.rb
riddle-2.3.2 lib/riddle/configuration/template_index.rb
riddle-2.3.1 lib/riddle/configuration/template_index.rb
riddle-2.3.0 lib/riddle/configuration/template_index.rb
riddle-2.2.2 lib/riddle/configuration/template_index.rb
riddle-2.2.1 lib/riddle/configuration/template_index.rb