Sha256: cf3f36b6c6dbef76d237c542b7b09f3cc803972067fcdd43d500870ce0d20895

Contents?: true

Size: 892 Bytes

Versions: 7

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

module Riddle
  class Configuration
    class Searchd
      NUMBER = 1.class

      def valid?
        set_listen

        !( @listen.nil? || @listen.empty? || @pid_file.nil? )
      end

      private

      def set_listen
        @listen = @listen.to_s if @listen.is_a?(NUMBER)

        return unless @listen.nil? || @listen.empty?

        @listen = []
        @listen << @port.to_s if @port
        @listen << "9306:mysql41" if @mysql41.is_a?(TrueClass)
        @listen << "#{@mysql41}:mysql41" if @mysql41.is_a?(NUMBER)

        if @listen.empty? && @address
          @listen << @address
        else
          @listen = @listen.collect { |line| "#{@address}:#{line}" } if @address
        end

        @listen += Array(@socket) if @socket
      end

      def settings
        @listen.nil? ? super : super - [:address, :port]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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