Module: Stateoscope

Defined in:
lib/stateoscope.rb,
lib/stateoscope/graph.rb,
lib/stateoscope/railtie.rb,
lib/stateoscope/version.rb,
lib/stateoscope/visualizer.rb,
lib/stateoscope/integrations.rb,
lib/stateoscope/integrations/aasm.rb

Defined Under Namespace

Modules: Integrations Classes: Graph, Railtie, Visualizer

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.filename_for(integration) ⇒ Object


15
16
17
# File 'lib/stateoscope.rb', line 15

def self.filename_for(integration)
  "#{integration.full_state_machine_name}-#{Time.now.utc.strftime('%Y%m%d%H%M%s')}"
end

.visualize(klass, options = {}) ⇒ Object


8
9
10
11
12
13
# File 'lib/stateoscope.rb', line 8

def self.visualize(klass, options = {})
  state_machine_name = options.fetch(:state_machine_name, nil)
  integration = Integrations.new_for(klass, state_machine_name)
  filename = options.fetch(:filename, filename_for(integration))
  Visualizer.new(integration.graph).output(filename)
end