Parent

Included Modules

Class/Module Index [+]

Quicksearch

Statsample::Analysis::Suite

Attributes

output[RW]
name[RW]
block[R]

Public Class Methods

new(opts=Hash.new(), &block) click to toggle source
# File lib/statsample/analysis/suite.rb, line 8
def initialize(opts=Hash.new(), &block)
  if !opts.is_a? Hash
    opts={:name=>opts}
  end
   
  @block=block
  @name=opts[:name] || "Analysis #{Time.now}"
  @attached=[]
  @output=opts[:output] || ::STDOUT
  
end

Public Instance Methods

add_to_reportbuilder(rb) click to toggle source
# File lib/statsample/analysis/suite.rb, line 29
def add_to_reportbuilder(rb)
  SuiteReportBuilder.new({:name=>name, :rb=>rb}, &block)
end
attach(ds) click to toggle source
# File lib/statsample/analysis/suite.rb, line 42
def attach(ds)
  @attached.push(ds)
end
boxplot(*args) click to toggle source
# File lib/statsample/analysis/suite.rb, line 62
def boxplot(*args)
  show_svg(old_boxplot(*args).to_svg)
end
Also aliased as: old_boxplot
detach(ds=nil) click to toggle source
# File lib/statsample/analysis/suite.rb, line 45
def detach(ds=nil)
  if ds.nil?
    @attached.pop
  else
    @attached.delete(ds)
  end
end
echo(*args) click to toggle source
# File lib/statsample/analysis/suite.rb, line 23
def echo(*args)
  @output.puts(*args)
end
generate(filename) click to toggle source
# File lib/statsample/analysis/suite.rb, line 33
def generate(filename)
  ar=SuiteReportBuilder.new({:name=>name}, &block)
  ar.generate(filename)
end
histogram(*args) click to toggle source
# File lib/statsample/analysis/suite.rb, line 65
def histogram(*args)
  show_svg(old_histogram(*args).to_svg)
end
Also aliased as: old_histogram
method_missing(name, *args,&block) click to toggle source
# File lib/statsample/analysis/suite.rb, line 72
def method_missing(name, *args,&block)
  @attached.reverse.each do |ds|
    return ds[name.to_s] if ds.fields.include? (name.to_s)
  end
  raise "Method #{name} doesn't exists"
end
old_boxplot(*args) click to toggle source
Alias for: boxplot
old_histogram(*args) click to toggle source
Alias for: histogram
old_scatterplot(*args) click to toggle source
Alias for: scatterplot
run() click to toggle source

Run the analysis, putting output on

# File lib/statsample/analysis/suite.rb, line 20
def run
   @block.arity<1 ? instance_eval(&@block) : @block.call(self)
end
scatterplot(*args) click to toggle source
# File lib/statsample/analysis/suite.rb, line 68
def scatterplot(*args)
  show_svg(old_scatterplot(*args).to_svg)
end
Also aliased as: old_scatterplot
show_svg(svg) click to toggle source
# File lib/statsample/analysis/suite.rb, line 56
def show_svg(svg)
  require 'tmpdir'
  fn=Dir.tmpdir+"/image_#{Time.now.to_f}.svg"
  File.open(fn,"w") {|fp| fp.write svg}
  `xdg-open '#{fn}'`
end
summary(obj) click to toggle source
# File lib/statsample/analysis/suite.rb, line 26
def summary(obj)
  obj.summary
end
to_text() click to toggle source
# File lib/statsample/analysis/suite.rb, line 37
def to_text
  ar=SuiteReportBuilder.new({:name=>name}, &block)
  ar.to_text
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.