Class: RailsApiBenchmark::Views::ResultsMarkdown

Inherits:
View
  • Object
show all
Defined in:
lib/rails_api_benchmark/results_markdown.rb,
lib/rails_api_benchmark/views/results_markdown.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from View

#file_path

Constructor Details

#initialize(target, results) ⇒ ResultsMarkdown

Returns a new instance of ResultsMarkdown.



8
9
10
11
12
13
# File 'lib/rails_api_benchmark/results_markdown.rb', line 8

def initialize(target, results)
  super
  @title = target.title
  @req_per_sec = results[:req_per_sec] || 'Unknown'
  @response_time = results[:response_time] || 'Unknown'
end

Instance Attribute Details

#req_per_secObject (readonly)

Returns the value of attribute req_per_sec.



6
7
8
# File 'lib/rails_api_benchmark/results_markdown.rb', line 6

def req_per_sec
  @req_per_sec
end

#response_timeObject (readonly)

Returns the value of attribute response_time.



6
7
8
# File 'lib/rails_api_benchmark/results_markdown.rb', line 6

def response_time
  @response_time
end

#resultsObject (readonly)

Returns the value of attribute results.



6
7
8
# File 'lib/rails_api_benchmark/views/results_markdown.rb', line 6

def results
  @results
end

#targetObject (readonly)

Returns the value of attribute target.



6
7
8
# File 'lib/rails_api_benchmark/views/results_markdown.rb', line 6

def target
  @target
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/rails_api_benchmark/results_markdown.rb', line 6

def title
  @title
end

Instance Method Details

#extensionObject

Maybe put this in a superclass like MarkdownView to DRY



16
17
18
# File 'lib/rails_api_benchmark/results_markdown.rb', line 16

def extension
  'md'
end

#file_nameObject



20
21
22
# File 'lib/rails_api_benchmark/results_markdown.rb', line 20

def file_name
  'results'
end

#folderObject



24
25
26
# File 'lib/rails_api_benchmark/results_markdown.rb', line 24

def folder
  @target.name
end