Class: ActiveUsage::Tags

Inherits:
Object
  • Object
show all
Defined in:
lib/active_usage/tags.rb

Constant Summary collapse

KEY =
:activeusage_tags

Instance Method Summary collapse

Constructor Details

#initialize(tags) ⇒ Tags

Returns a new instance of Tags.



7
8
9
# File 'lib/active_usage/tags.rb', line 7

def initialize(tags)
  @tags = tags
end

Instance Method Details

#currentObject



15
16
17
# File 'lib/active_usage/tags.rb', line 15

def current
  ActiveSupport::IsolatedExecutionState[KEY] || @tags
end

#flushObject



19
20
21
# File 'lib/active_usage/tags.rb', line 19

def flush
  ActiveSupport::IsolatedExecutionState[KEY] = @tags
end

#tag(**tags) ⇒ Object



11
12
13
# File 'lib/active_usage/tags.rb', line 11

def tag(**tags)
  ActiveSupport::IsolatedExecutionState[KEY] = current.merge(tags)
end