Class: NoFlyList::Config
- Inherits:
-
Object
- Object
- NoFlyList::Config
- Defined in:
- lib/no_fly_list/taggable_record/config.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#tag_contexts ⇒ Object
readonly
Returns the value of attribute tag_contexts.
-
#taggable_class ⇒ Object
readonly
Returns the value of attribute taggable_class.
Instance Method Summary collapse
- #add_context(context, options = {}) ⇒ Object
-
#initialize(taggable_class = nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(taggable_class = nil) ⇒ Config
Returns a new instance of Config.
7 8 9 10 11 |
# File 'lib/no_fly_list/taggable_record/config.rb', line 7 def initialize(taggable_class = nil) @tag_contexts = {} @taggable_class = taggable_class @adapter = determine_adapter end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
5 6 7 |
# File 'lib/no_fly_list/taggable_record/config.rb', line 5 def adapter @adapter end |
#tag_contexts ⇒ Object (readonly)
Returns the value of attribute tag_contexts.
5 6 7 |
# File 'lib/no_fly_list/taggable_record/config.rb', line 5 def tag_contexts @tag_contexts end |
#taggable_class ⇒ Object (readonly)
Returns the value of attribute taggable_class.
5 6 7 |
# File 'lib/no_fly_list/taggable_record/config.rb', line 5 def taggable_class @taggable_class end |
Instance Method Details
#add_context(context, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/no_fly_list/taggable_record/config.rb', line 13 def add_context(context, = {}) context = context.to_sym tag_class_name = determine_tag_class_name() tagging_class_name = determine_tagging_class_name() @tag_contexts[context] = { taggable_class: @taggable_class.to_s, tag_class_name: tag_class_name, tagging_class_name: tagging_class_name, transformer: .fetch(:transformer, ApplicationTagTransformer).to_s, polymorphic: .fetch(:polymorphic, false), restrict_to_existing: .fetch(:restrict_to_existing, false), limit: .fetch(:limit, nil), case_sensitive: .fetch(:case_sensitive, true), adapter: @adapter, counter_cache: .fetch(:counter_cache, false) } end |