Class: Fukuzatsu::Formatters::JsonIndex

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/fukuzatsu/formatters/json_index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Base

#export, included, #output_directory, #output_path, #path_to_results

Constructor Details

#initialize(summaries, base_output_path) ⇒ JsonIndex

Returns a new instance of JsonIndex.



11
12
13
14
# File 'lib/fukuzatsu/formatters/json_index.rb', line 11

def initialize(summaries, base_output_path)
  @summaries = summaries
  @base_output_path = base_output_path
end

Instance Attribute Details

#summariesObject (readonly)

Returns the value of attribute summaries.



9
10
11
# File 'lib/fukuzatsu/formatters/json_index.rb', line 9

def summaries
  @summaries
end

Instance Method Details

#contentObject



16
17
18
# File 'lib/fukuzatsu/formatters/json_index.rb', line 16

def content
  summaries.map { |summary| Json.new(summary: summary, base_output_path: self.base_output_path).as_json }.to_json
end

#file_extensionObject



24
25
26
# File 'lib/fukuzatsu/formatters/json_index.rb', line 24

def file_extension
  ".json"
end

#filenameObject



20
21
22
# File 'lib/fukuzatsu/formatters/json_index.rb', line 20

def filename
  "json/results.json"
end