Module: Fruity

Extended by:
Fruity
Included in:
Fruity
Defined in:
lib/fruity/util.rb,
lib/fruity/group.rb,
lib/fruity/runner.rb,
lib/fruity/baseline.rb,
lib/fruity/comparison_run.rb,
lib/fruity/named_block_collector.rb,
lib/fruity/base.rb

Defined Under Namespace

Modules: Baseline, Util Classes: ComparisonRun, Group, NamedBlockCollector, Runner

Constant Summary collapse

GLOBAL_SCOPE =
self
DEFAULT_OPTIONS =
{
  :on         => GLOBAL_SCOPE,
  :samples    => 20,
  :disable_gc => false,
  :filter     => [0, 0.2],        # Proportion of samples to discard [lower_end, upper_end]
  :baseline   => :single,         # Either :none, :single or :split
}
OTHER_OPTIONS =
[
  :magnify,
  :args,
  :self,
  :verbose,
]
OPTIONS =
DEFAULT_OPTIONS.keys + OTHER_OPTIONS

Instance Method Summary collapse

Instance Method Details

#compare(*stuff, &block) ⇒ Object



32
33
34
# File 'lib/fruity/base.rb', line 32

def compare(*stuff, &block)
  puts report(*stuff, &block)
end

#report(*stuff, &block) ⇒ Object



28
29
30
# File 'lib/fruity/base.rb', line 28

def report(*stuff, &block)
  Fruity::Runner.new(Fruity::Group.new(*stuff, &block)).run(&:feedback)
end

#study(*stuff, &block) ⇒ Object



36
37
38
39
40
41
# File 'lib/fruity/base.rb', line 36

def study(*stuff, &block)
  run = Fruity::Runner.new(Fruity::Group.new(*stuff, &block)).run(:baseline => :single, &:feedback)
  path = run.export
  `open "#{path}"`
  run
end