Module: Statecraft

Defined in:
lib/statecraft/errors.rb,
lib/statecraft/diagram.rb,
lib/statecraft/machine.rb,
lib/statecraft/version.rb,
lib/statecraft/metadata.rb,
lib/statecraft/mounting.rb,
lib/statecraft/pipeline.rb,
lib/statecraft/warnings.rb,
lib/statecraft/introspection.rb,
lib/statecraft/rspec/matchers.rb,
lib/statecraft/instrumentation.rb,
lib/statecraft/rspec/have_edge.rb,
lib/statecraft/pipeline/surface.rb,
lib/statecraft/rspec/transition.rb,
lib/statecraft/rspec/allow_event.rb,
lib/statecraft/rspec/refuse_event.rb,
lib/statecraft/rspec/state_report.rb,
lib/statecraft/pipeline/versioning.rb,
lib/statecraft/pipeline/edge_resolution.rb,
lib/statecraft/rspec/have_initial_state.rb,
lib/statecraft/rspec/allow_transition_to.rb,
lib/statecraft/rspec/have_transitioned_to.rb,
lib/generators/statecraft/machine/machine_generator.rb,
lib/generators/statecraft/from_statesman/from_statesman_generator.rb

Defined Under Namespace

Modules: Diagram, Generators, Instrumentation, Introspection, Machine, Metadata, Mounting, RSpec Classes: AlreadyMounted, ChainDepthExceeded, CompilationError, CompositePrimaryKeyUnsupported, ConnectionMismatch, DirtyRecordError, Error, GuardFailed, InvalidTransition, NestedTransitionError, Pipeline, StaleTransition, TransitionConflict, UnsavedRecordError

Constant Summary collapse

VERSION =
"0.7.1"
WARNING_DEDUP_MUTEX =
Mutex.new

Class Method Summary collapse

Class Method Details

.warn(key, message) ⇒ Object

The single internal warning funnel. Speaks to the developer at the keyboard through Kernel#warn (stderr) — never through Rails.logger, which may not exist, may be unconfigured at mounting time, and hides test-run warnings in a log file nobody reads. Deduplicates once-per-key-per-process and is deliberately not configurable: a "where do warnings go" knob would be the first global setting of a gem that has none.



10
11
12
13
14
15
16
17
# File 'lib/statecraft/warnings.rb', line 10

def self.warn(key, message)
  WARNING_DEDUP_MUTEX.synchronize do
    return if emitted_warning_keys.include?(key)

    emitted_warning_keys << key
  end
  Kernel.warn("[statecraft] #{message}")
end