module BenchmarkSpec::SharedContext
Public Class Methods
included(klass)
click to toggle source
# File lib/benchmark_spec/shared_context.rb, line 3 def self.included(klass) klass.class_eval do @@shared_context ||= {} class << klass def shared_context(context_name, &block) @@shared_context[context_name] = block end end end end
Public Instance Methods
include_context(context_name)
click to toggle source
# File lib/benchmark_spec/shared_context.rb, line 16 def include_context(context_name) raise "Shared context #{context_name.to_s} does not exist!" if @@shared_context[context_name].nil? instance_eval &@@shared_context[context_name] end