Sha256: d506e73f95e28daec58d0457948a7fbef3e6313b424dd0e183de199fcde2e710

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

module Riddle
  class Configuration
    class Searchd < Riddle::Configuration::Section
      self.settings = [:listen, :address, :port, :log, :query_log,
        :read_timeout, :client_timeout, :max_children, :pid_file, :max_matches,
        :seamless_rotate, :preopen_indexes, :unlink_old, :attr_flush_period,
        :ondisk_dict_default, :max_packet_size, :mva_updates_pool,
        :crash_log_path, :max_filters, :max_filter_values]
      
      attr_accessor *self.settings
            
      def render
        raise ConfigurationError unless valid?
        
        (
          ["searchd", "{"] +
          settings_body +
          ["}", ""]
        ).join("\n")
      end
      
      def valid?
        set_listen
        clear_deprecated
        
        !( @listen.nil? || @pid_file.nil? )
      end
      
      private
      
      def set_listen
        return unless @listen.nil?
        
        @listen = @port.to_s if @port && @address.nil?
        @listen = "#{@address}:#{@port}" if @address && @port
      end
      
      def clear_deprecated
        return if @listen.nil?
        
        @address  = nil
        @port     = nil
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
hariton-thinking-sphinx-1.2.11.2 vendor/riddle/lib/riddle/configuration/searchd.rb
hariton-thinking-sphinx-1.2.11 vendor/riddle/lib/riddle/configuration/searchd.rb
hariton-thinking-sphinx-1.2.7.0 vendor/riddle/lib/riddle/configuration/searchd.rb
hariton-thinking-sphinx-1.2.7.1 vendor/riddle/lib/riddle/configuration/searchd.rb
thinking-sphinx-099-1.3.2 vendor/riddle/lib/riddle/configuration/searchd.rb
thinking-sphinx-099-1.3.1 vendor/riddle/lib/riddle/configuration/searchd.rb
thinking-sphinx-099-1.3.0 vendor/riddle/lib/riddle/configuration/searchd.rb
thinking-sphinx-099-1.2.13 vendor/riddle/lib/riddle/configuration/searchd.rb
thinking-sphinx-099-1.2.12 vendor/riddle/lib/riddle/configuration/searchd.rb