Sha256: 6752d3ec515734604b7c3c024ee017706c7529f19f50350e648c3a9b1a08d6b3

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

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

      def self.settings
        Riddle::Configuration::IndexSettings.settings + [
          :rt_mem_limit, :rt_field, :rt_attr_uint, :rt_attr_bigint,
          :rt_attr_float, :rt_attr_timestamp, :rt_attr_string, :rt_attr_multi,
          :rt_attr_multi_64, :rt_attr_bool, :rt_attr_json
        ]
      end

      attr_accessor :rt_mem_limit, :rt_field, :rt_attr_uint, :rt_attr_bigint,
        :rt_attr_float, :rt_attr_timestamp, :rt_attr_string, :rt_attr_multi,
        :rt_attr_multi_64, :rt_attr_bool, :rt_attr_json

      def initialize(name)
        @name               = name
        @rt_field           = []
        @rt_attr_uint       = []
        @rt_attr_bigint     = []
        @rt_attr_float      = []
        @rt_attr_timestamp  = []
        @rt_attr_string     = []
        @rt_attr_multi      = []
        @rt_attr_multi_64   = []
        @rt_attr_bool       = []
        @rt_attr_json       = []

        initialize_settings
      end

      def type
        "rt"
      end

      def valid?
        !(@name.nil? || @path.nil?)
      end

      def render
        raise ConfigurationError unless valid?

        (
          ["index #{name}", "{"] +
          settings_body +
          ["}", ""]
        ).join("\n")
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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