Sha256: 3fc4c2c10b79fee37b120901f875b4ebe4d9a1dbf45abaac85cf334520776ba0

Contents?: true

Size: 971 Bytes

Versions: 5

Compression:

Stored size: 971 Bytes

Contents

module Riddle
  class Configuration
    class RealtimeIndex < Riddle::Configuration::Section
      def self.settings
        [
          :type, :path, :rt_mem_limit, :rt_field, :rt_attr_uint,
          :rt_attr_bigint, :rt_attr_float, :rt_attr_timestamp, :rt_attr_string
        ]
      end
      
      attr_accessor :name
      attr_accessor *self.settings
      
      def initialize(name)
        @name               = name
        @rt_field           = []
        @rt_attr_uint       = []
        @rt_attr_bigint     = []
        @rt_attr_float      = []
        @rt_attr_timestamp  = []
        @rt_attr_string     = []
      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

5 entries across 5 versions & 1 rubygems

Version Path
riddle-1.5.3 lib/riddle/configuration/realtime_index.rb
riddle-1.5.2 lib/riddle/configuration/realtime_index.rb
riddle-1.5.1 lib/riddle/configuration/realtime_index.rb
riddle-1.5.0 lib/riddle/configuration/realtime_index.rb
riddle-1.4.0 lib/riddle/configuration/realtime_index.rb