Class: EasyTags::TaggableContext
- Inherits:
-
Object
- Object
- EasyTags::TaggableContext
- Defined in:
- lib/easy_tags/taggable_context.rb
Overview
Handles tag context manipulation
Instance Method Summary collapse
- #changed? ⇒ true, false
-
#initialize(context:, refresh_persisted_tags:, on_change:) ⇒ TaggableContext
constructor
A new instance of TaggableContext.
- #new_tags ⇒ TagList
- #persisted_tags ⇒ TagList
-
#refresh ⇒ Object
clear memoized info and force a refresh.
- #removed_tags ⇒ TagList
- #tags ⇒ TagList
- #update(value) ⇒ TagList
Constructor Details
#initialize(context:, refresh_persisted_tags:, on_change:) ⇒ TaggableContext
Returns a new instance of TaggableContext.
7 8 9 10 11 |
# File 'lib/easy_tags/taggable_context.rb', line 7 def initialize(context:, refresh_persisted_tags:, on_change:) self.context = context self. = self.on_change = on_change end |
Instance Method Details
#changed? ⇒ true, false
14 15 16 |
# File 'lib/easy_tags/taggable_context.rb', line 14 def changed? .sort != .sort end |
#persisted_tags ⇒ TagList
24 25 26 |
# File 'lib/easy_tags/taggable_context.rb', line 24 def @persisted_tags ||= TagList.new(.call) end |
#refresh ⇒ Object
clear memoized info and force a refresh
47 48 49 50 |
# File 'lib/easy_tags/taggable_context.rb', line 47 def refresh @tags = nil @persisted_tags = nil end |