Module: UsageTracker::Context

Defined in:
lib/usage_tracker/context.rb

Constant Summary collapse

@@key =
'usage_tracker.context'.freeze

Instance Method Summary collapse

Instance Method Details

#usage_tracker_context(data) ⇒ Object

Shorthand for self.usage_tracker_context = data



22
23
24
# File 'lib/usage_tracker/context.rb', line 22

def usage_tracker_context(data)
  self.usage_tracker_context = data
end

#usage_tracker_context=(data) ⇒ Object

Sets the env Key variable with the provided data



10
11
12
13
14
15
16
17
18
# File 'lib/usage_tracker/context.rb', line 10

def usage_tracker_context=(data)
  unless request.env[key].blank?
    unless Rails.env.test? && !caller.grep(/test\/functional/).blank?
      UsageTracker.log 'WARNING: overwriting context data!'
    end
  end

  request.env[key] = data
end