module SunspotCell::CompositeSetup::InstanceMethods

Public Instance Methods

all_attachment_fields() click to toggle source

Collection of all attachment fields configured for any of the enclosed types.

Returns

Array

Text fields configured for the enclosed types

# File lib/sunspot_cell/composite_setup.rb, line 18
def all_attachment_fields
  @attachment_fields ||= attachment_fields_hash.values.map { |set| set.to_a }.flatten
end

Private Instance Methods

attachment_fields_hash() click to toggle source

Return a hash of field names to atachment field objects, containing all fields that are configured for any of the types enclosed.

Returns

Hash

Hash of field names to text field objects.

# File lib/sunspot_cell/composite_setup.rb, line 31
def attachment_fields_hash
  @attachment_fields_hash ||=
    setups.inject({}) do |hash, setup|
      setup.all_attachment_fields.each do |text_field|
        (hash[text_field.name] ||= Set.new) << text_field
      end
      hash
    end
end