Module: Consumer::PositionStore::ClassConfigure

Defined in:
lib/consumer/position_store.rb

Instance Method Summary collapse

Instance Method Details

#configure(receiver, *arguments, attr_name: nil, **keyword_arguments) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/consumer/position_store.rb', line 35

def configure(receiver, *arguments, attr_name: nil, **keyword_arguments)
  attr_name ||= :position_store

  if keyword_arguments.any?
    position_store = build(*arguments, **keyword_arguments)
  else
    position_store = build(*arguments)
  end

  receiver.public_send("#{attr_name}=", position_store)

  position_store
end