Sha256: 0a821f113f78b5ab0ce12d2871bdc82d07f7de66a825214cc76c084aca886a5f

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

require 'riddle/configuration/section'
require 'riddle/configuration/index_settings'

require 'riddle/configuration/common'
require 'riddle/configuration/distributed_index'
require 'riddle/configuration/index'
require 'riddle/configuration/indexer'
require 'riddle/configuration/realtime_index'
require 'riddle/configuration/remote_index'
require 'riddle/configuration/searchd'
require 'riddle/configuration/source'
require 'riddle/configuration/sql_source'
require 'riddle/configuration/template_index'
require 'riddle/configuration/tsv_source'
require 'riddle/configuration/xml_source'

require 'riddle/configuration/parser'

module Riddle
  class Configuration
    class ConfigurationError < StandardError #:nodoc:
    end

    attr_reader :common, :indices, :searchd, :sources
    attr_accessor :indexer

    def self.parse!(input)
      Riddle::Configuration::Parser.new(input).parse!
    end

    def initialize
      @common  = Riddle::Configuration::Common.new
      @indexer = Riddle::Configuration::Indexer.new
      @searchd = Riddle::Configuration::Searchd.new
      @indices = []
      @sources = []
    end

    def render
      (
        [@common.render, @indexer.render, @searchd.render] +
        @sources.collect { |source| source.render } +
        @indices.collect { |index| index.render }
      ).join("\n")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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