Class: YARD::Handlers::BenchmarkHandler
- Inherits:
-
Ruby::DSLHandler
- Object
- Ruby::DSLHandler
- YARD::Handlers::BenchmarkHandler
- Defined in:
- lib/yard-bench/handler.rb
Overview
end
Instance Method Summary collapse
- #find_file(file) ⇒ Object
-
#process ⇒ Object
we should only match method calls inside a namespace (class or module), not inside a method namespace_only.
Instance Method Details
#find_file(file) ⇒ Object
40 41 42 |
# File 'lib/yard-bench/handler.rb', line 40 def find_file(file) end |
#process ⇒ Object
we should only match method calls inside a namespace (class or module), not inside a method namespace_only
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/yard-bench/handler.rb', line 21 def process cos = [] statement.parameters.each { |astnode| if astnode.respond_to? :jump m = "#{astnode.jump(:string_content).source[1..-1]}" # [1..-1] is to get rid of symbol’s colon if res = YARD::Bench::Marks.get("#{statement.file}", "#{namespace}", "#{m}") obj = YARD::CodeObjects::MethodObject.new(namespace, "#{m}") obj.benchmarks = res.map { |e| e.times }.flatten obj.power = res.map { |e| e.power }.flatten[0] obj.deviation = res.map { |e| e.deviation }.flatten[0] obj.memory = res.map { |e| e.memory }.flatten cos << obj # bmo = BenchmarkObject.new(namespace, m) end end } cos end |