Class: BenchPress::RubyBenchmark

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/bench_press/ruby_benchmark.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ RubyBenchmark

Returns a new instance of RubyBenchmark.



17
18
19
# File 'lib/bench_press/ruby_benchmark.rb', line 17

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



15
16
17
# File 'lib/bench_press/ruby_benchmark.rb', line 15

def response
  @response
end

Class Method Details

.publish(measurable, file_path) ⇒ Object



8
9
10
11
12
13
# File 'lib/bench_press/ruby_benchmark.rb', line 8

def self.publish(measurable, file_path)
  report = measurable.report.to_hash
  report[:results_attributes] = report.delete(:runnables)
  report.merge! :source => File.read(file_path)
  new post("/reports", :body => {:report => report})
end

Instance Method Details

#to_sObject



21
22
23
# File 'lib/bench_press/ruby_benchmark.rb', line 21

def to_s
  response.body
end