Parent

BenchmarkSpec

Constants

READERS

Attributes

name[RW]

Public Class Methods

load(name, file_name = nil) click to toggle source
# File lib/railsbench/benchmark_specs.rb, line 23
def load(name, file_name = nil)
  unless file_name
    file_name = ENV['RAILS_ROOT'] + "/config/benchmarks.yml"
  end
  @@specs = YAML::load(ERB.new(IO.read(file_name)).result)
  raise "There is no benchmark named '#{name}'" unless @@specs[name]
  parse(@@specs, name)
end
new(name, hash) click to toggle source
# File lib/railsbench/benchmark_specs.rb, line 13
def initialize(name, hash)
  super(hash)
  @name = name
end
parse(specs, name) click to toggle source
# File lib/railsbench/benchmark_specs.rb, line 32
def parse(specs, name)
  spec = specs[name]
  if spec.is_a?(String)
    spec.split(/, */).collect!{ |n| parse(specs, n) }.flatten
  elsif spec.is_a?(Hash)
    [ BenchmarkSpec.new(name,spec) ]
  elsif spec.is_a?(Array)
    spec.collect{|n| parse(specs, n)}.flatten
  else
    raise "oops: unknown entry type in benchmark specification"
  end
end

Public Instance Methods

inspect() click to toggle source
# File lib/railsbench/benchmark_specs.rb, line 18
def inspect
  "BenchmarkSpec(#{name},#{super})"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.