Method: NoFlyList::Config#add_context

Defined in:
lib/no_fly_list/taggable_record/config.rb

#add_context(context, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/no_fly_list/taggable_record/config.rb', line 13

def add_context(context, options = {})
  context = context.to_sym
  tag_class_name = determine_tag_class_name(options)
  tagging_class_name = determine_tagging_class_name(options)

  @tag_contexts[context] = {
    taggable_class: @taggable_class.to_s,
    tag_class_name: tag_class_name,
    tagging_class_name: tagging_class_name,
    transformer: options.fetch(:transformer, ApplicationTagTransformer).to_s,
    polymorphic: options.fetch(:polymorphic, false),
    restrict_to_existing: options.fetch(:restrict_to_existing, false),
    limit: options.fetch(:limit, nil),
    case_sensitive: options.fetch(:case_sensitive, true),
    adapter: @adapter
  }
end