Class: Chewy::Index::Witchcraft::Cauldron

Inherits:
Object
  • Object
show all
Defined in:
lib/chewy/index/witchcraft.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index, fields: []) ⇒ Cauldron

Returns a new instance of Cauldron.

Parameters:

  • index (Chewy::Index)

    index for composition

  • fields (Array<Symbol>) (defaults to: [])

    restricts the fields for composition



56
57
58
59
60
# File 'lib/chewy/index/witchcraft.rb', line 56

def initialize(index, fields: [])
  @index = index
  @locals = []
  @fields = fields
end

Instance Attribute Details

#localsObject (readonly)

Returns the value of attribute locals.



52
53
54
# File 'lib/chewy/index/witchcraft.rb', line 52

def locals
  @locals
end

Instance Method Details

#brew(object, crutches = nil, context = {}) ⇒ Object



62
63
64
# File 'lib/chewy/index/witchcraft.rb', line 62

def brew(object, crutches = nil, context = {})
  alicorn.call(locals, object, crutches, context).as_json
end