Module: StateMachines::Graphviz
- Defined in:
- lib/state_machines/graphviz/version.rb,
lib/state_machines/graphviz.rb,
lib/state_machines/graphviz/renderer.rb
Overview
Gem version
Defined Under Namespace
Modules: Renderer
Constant Summary collapse
- VERSION =
'0.1.0'
Class Method Summary collapse
Class Method Details
.draw(class_names, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/state_machines/graphviz.rb', line 13 def draw(class_names, = {}) if class_names.nil? || class_names.to_s.split(',').empty? raise ArgumentError, 'At least one class must be specified' end # Load any files if (files = .delete(:file)) files.split(',').each { |file| require file } end class_names.to_s.split(',').each do |class_name| # Navigate through the namespace structure to get to the class klass = Object class_name.split('::').each do |name| klass = klass.const_defined?(name) ? klass.const_get(name) : klass.const_missing(name) end # Draw each of the class's state machines klass.state_machines.each_value do |machine| machine.draw(**) end end end |