Sha256: c543bd4adcba6c55f62ea0047386552a9a29a8558f4066fecd40b29aff8658d4

Contents?: true

Size: 901 Bytes

Versions: 12

Compression:

Stored size: 901 Bytes

Contents

module AgnosticBackend
  module Cloudsearch
    class RemoteIndexField

      attr_reader :field, :status

      # returns an array with two elements:
      # the first is an array with the remote fields that correspond to local fields
      # the second is an array with the remote that do not have corresponding local fields
      def self.partition(local_fields, remote_fields)
        local_field_names = local_fields.map(&:name)
        remote_fields.partition do |remote_field|
          local_field_names.include? remote_field.index_field_name
        end
      end

      def initialize(remote_field_struct)
        @field = remote_field_struct.options
        @status = remote_field_struct.status
      end

      def method_missing(method_name)
        if field.respond_to?(method_name)
          field.send(method_name)
        else
          super
        end
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
agnostic_backend-1.0.4 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-1.0.3 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-1.0.2 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-1.0.1 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-1.0.0 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-0.9.9 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-0.9.8 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-0.9.4 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-0.9.3 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-0.9.2 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-0.9.1 lib/agnostic_backend/cloudsearch/remote_index_field.rb
agnostic_backend-0.9.0 lib/agnostic_backend/cloudsearch/remote_index_field.rb