Class: Apipie::Generator::Swagger::ComputedInterfaceId

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/apipie/generator/swagger/computed_interface_id.rb

Overview

Note:

At the moment, this only takes operation ids into account, and ignores

The id is a number that is uniquely derived from the list of operations added to the swagger definition (in an order-dependent way). it can be used for regression testing, allowing some differentiation between changes that result from changes to the input and those that result from changes to the generation algorithms.

parameter definitions, so it’s only partially useful.

Instance Method Summary collapse

Constructor Details

#initializeComputedInterfaceId

Returns a new instance of ComputedInterfaceId.



12
13
14
# File 'lib/apipie/generator/swagger/computed_interface_id.rb', line 12

def initialize
  @computed_interface_id = 0
end

Instance Method Details

#add!(operation_id) ⇒ Object



16
17
18
# File 'lib/apipie/generator/swagger/computed_interface_id.rb', line 16

def add!(operation_id)
  @computed_interface_id = Zlib.crc32("#{@computed_interface_id} #{operation_id}")
end

#idObject



20
21
22
# File 'lib/apipie/generator/swagger/computed_interface_id.rb', line 20

def id
  @computed_interface_id
end