module BenchmarkSpec::DSL::ClassMethods

Public Instance Methods

change_global_dsl(context, &changes) click to toggle source
# File lib/benchmark_spec/dsl.rb, line 8
def change_global_dsl(context, &changes)
  (class << context; self; end).class_exec(&changes)
end
expose_method_dsl_to_context(method, context) click to toggle source
# File lib/benchmark_spec/dsl.rb, line 12
def expose_method_dsl_to_context(method, context)
  change_global_dsl(context) do
    remove_method(method) if method_defined?(method)
    define_method(method) do |*a, &b|
      BenchmarkSpec.__send__(method, *a, &b)
    end
  end
end
expose_methods_to_context(methods, context) click to toggle source
# File lib/benchmark_spec/dsl.rb, line 21
def expose_methods_to_context(methods, context)
  methods.each {|meth| expose_method_dsl_to_context(meth, context)}
end