Module: Vanity

Defined in:
lib/vanity.rb,
lib/vanity/version.rb,
lib/vanity/helpers.rb,
lib/vanity/playground.rb,
lib/vanity/metric/base.rb,
lib/vanity/metric/remote.rb,
lib/vanity/commands/list.rb,
lib/vanity/experiment/base.rb,
lib/vanity/commands/report.rb,
lib/vanity/commands/upgrade.rb,
lib/vanity/frameworks/rails.rb,
lib/vanity/experiment/ab_test.rb,
lib/vanity/metric/active_record.rb,
lib/vanity/adapters/mock_adapter.rb,
lib/vanity/adapters/redis_adapter.rb,
lib/vanity/metric/google_analytics.rb,
lib/vanity/adapters/mongodb_adapter.rb,
lib/vanity/adapters/abstract_adapter.rb,
lib/vanity/adapters/active_record_adapter.rb

Overview

All the cool stuff happens in other places.

See Also:

Defined Under Namespace

Modules: Adapters, Commands, Experiment, Helpers, Rails, Render, Version Classes: Metric, Playground

Constant Summary

VERSION =
"1.7.1"

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Class Attribute Details

+ (Object) playground

The playground instance.

See Also:



352
353
354
355
356
# File 'lib/vanity/playground.rb', line 352

def playground
  # In the case of Rails, use the Rails logger and collect only for
  # production environment by default.
  @playground ||= Playground.new(:rails=>defined?(::Rails))
end

Class Method Details

+ (Object) context

Returns the Vanity context. For example, when using Rails this would be the current controller, which can be used to get/set the vanity identity.



361
362
363
# File 'lib/vanity/playground.rb', line 361

def context
  Thread.current[:vanity_context]
end

+ (Object) context=(context)

Sets the Vanity context. For example, when using Rails this would be set by the set_vanity_context before filter (via Vanity::Rails#use_vanity).



367
368
369
# File 'lib/vanity/playground.rb', line 367

def context=(context)
  Thread.current[:vanity_context] = context
end

+ (Object) template(name)

Path to template.



372
373
374
375
376
# File 'lib/vanity/playground.rb', line 372

def template(name)
  path = File.join(File.dirname(__FILE__), "templates/#{name}")
  path << ".erb" unless name["."]
  path
end