Module: Vanity

Defined in:
lib/vanity.rb,
lib/vanity/helpers.rb,
lib/vanity/version.rb,
lib/vanity/playground.rb,
lib/vanity/metric/base.rb,
lib/vanity/commands/list.rb,
lib/vanity/metric/remote.rb,
lib/vanity/commands/report.rb,
lib/vanity/experiment/base.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 collapse

VERSION =
"1.5.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.playgroundObject

The playground instance.

See Also:



294
295
296
# File 'lib/vanity/playground.rb', line 294

def playground
  @playground
end

Class Method Details

.contextObject

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.



298
299
300
# File 'lib/vanity/playground.rb', line 298

def context
  Thread.current[:vanity_context]
end

.context=(context) ⇒ Object

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).



304
305
306
# File 'lib/vanity/playground.rb', line 304

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

.template(name) ⇒ Object

Path to template.



309
310
311
312
313
# File 'lib/vanity/playground.rb', line 309

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