Module: AsyncapiCable

Defined in:
lib/asyncapi_cable.rb,
lib/asyncapi_cable/engine.rb,
lib/asyncapi_cable/version.rb,
lib/asyncapi_cable/rake_tasks.rb,
lib/asyncapi_cable/diagnostics.rb,
lib/asyncapi_cable/configuration.rb,
lib/asyncapi_cable/core/document.rb,
lib/asyncapi_cable/adapters/rspec.rb,
lib/asyncapi_cable/generator/runner.rb,
lib/asyncapi_cable/adapters/minitest.rb,
lib/asyncapi_cable/dsl/metadata_store.rb,
lib/asyncapi_cable/dsl/channel_context.rb,
lib/asyncapi_cable/runtime/channel_hook.rb,
lib/asyncapi_cable/dsl/operation_context.rb,
lib/asyncapi_cable/runtime/stream_matcher.rb,
lib/asyncapi_cable/testing/assert_helpers.rb,
lib/asyncapi_cable/generator/asyncapi_writer.rb,
lib/asyncapi_cable/runtime/contract_registry.rb,
lib/asyncapi_cable/runtime/payload_validator.rb,
lib/asyncapi_cable/generator/rake_task_support.rb,
lib/asyncapi_cable/components/reference_closure.rb,
lib/asyncapi_cable/generator/declaration_loader.rb,
app/controllers/asyncapi_cable/schemas_controller.rb

Defined Under Namespace

Modules: Adapters, Components, Core, Diagnostics, Dsl, Generator, RakeTasks, Runtime, Testing Classes: Configuration, Engine, Error, SchemasController

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configurationObject



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

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



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

def configure
  yield configuration
end

.reset_configuration!Object



28
29
30
# File 'lib/asyncapi_cable.rb', line 28

def reset_configuration!
  @configuration = Configuration.new
end

.schema_generating?Boolean

True when the current process was started by asyncapi_cable:generate (the rake task sets ASYNCAPI_CABLE_GENERATING=true in the subprocess).

Such a run loads declaration files for their channel blocks and never executes them, so a host test helper can skip its test-time setup:

unless AsyncapiCable.schema_generating?
require "rails/test_help"
end

Cable generation also sets openapi-ruby's OPENAPI_RUBY_GENERATING, so a helper already guarding on OpenapiRuby.schema_generating? needs no second guard.

Returns:

  • (Boolean)


45
46
47
# File 'lib/asyncapi_cable.rb', line 45

def schema_generating?
  ENV["ASYNCAPI_CABLE_GENERATING"] == "true"
end