Class: OpenapiContracts::Coverage::Store
- Inherits:
-
Object
- Object
- OpenapiContracts::Coverage::Store
- Defined in:
- lib/openapi_contracts/coverage/store.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #clear! ⇒ Object
- #increment!(path, method, status, media_type) ⇒ Object
-
#initialize ⇒ Store
constructor
A new instance of Store.
Constructor Details
#initialize ⇒ Store
Returns a new instance of Store.
5 6 7 |
# File 'lib/openapi_contracts/coverage/store.rb', line 5 def initialize @data = {} end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/openapi_contracts/coverage/store.rb', line 3 def data @data end |
Instance Method Details
#clear! ⇒ Object
9 10 11 |
# File 'lib/openapi_contracts/coverage/store.rb', line 9 def clear! @data = {} end |
#increment!(path, method, status, media_type) ⇒ Object
13 14 15 16 17 |
# File 'lib/openapi_contracts/coverage/store.rb', line 13 def increment!(path, method, status, media_type) keys = [path, method, status] val = @data.dig(*keys) || Hash.new(0).tap { |h| OpenapiContracts.hash_bury!(@data, keys, h) } val[media_type] += 1 end |