Class: OpenapiContracts::Coverage

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_contracts/coverage.rb,
lib/openapi_contracts/coverage/store.rb,
lib/openapi_contracts/coverage/report.rb

Defined Under Namespace

Classes: Report, Store

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ Coverage

Returns a new instance of Coverage.



13
14
15
16
# File 'lib/openapi_contracts/coverage.rb', line 13

def initialize(doc)
  @store = Store.new
  @doc = doc
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



11
12
13
# File 'lib/openapi_contracts/coverage.rb', line 11

def store
  @store
end

Class Method Details

.merge_reports(doc, *others) ⇒ Object



6
7
8
9
# File 'lib/openapi_contracts/coverage.rb', line 6

def self.merge_reports(doc, *others)
  reports = others.map { |fp| JSON(File.read(fp))['paths'] }
  Report.merge(doc, *reports)
end

Instance Method Details

#reportObject



20
21
22
# File 'lib/openapi_contracts/coverage.rb', line 20

def report
  Report.new(@doc, store.data)
end