Sha256: d72eae2ea46039bb510d2d264be3a6c734a6c495df447e2eefa4ba8ddadb505a

Contents?: true

Size: 669 Bytes

Versions: 1

Compression:

Stored size: 669 Bytes

Contents

module Indexes
  class Configuration

    attr_accessor :hosts, :log, :trace

    def computed_sorts
      @computed_sorts ||= {}
    end

    def mappings(&block)
      if block_given?
        @mappings = Dsl::Mappings.new(&block).to_h
      else
        @mappings
      end
    end

    def analysis(&block)
      if block_given?
        @analysis = { analysis: Dsl::Api.new(&block).to_h }
      else
        @analysis
      end
    end

    def suggestions(&block)
      if block_given?
        @suggestions = block
      else
        @suggestions
      end
    end

    def add_computed_sort(name, &block)
      self.computed_sorts[name] = block
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
indexes-0.0.1 lib/indexes/configuration.rb