Sha256: 9b6f2fa7c8903fd098a9b692ee1a34db3dcc1b5cdd17a5a58e14fcd524699e75
Contents?: true
Size: 765 Bytes
Versions: 2
Compression:
Stored size: 765 Bytes
Contents
module DrawSmd class Diagram class << self def schemas schemas = ActiveRecord::Base.connection.tables schemas.delete('schema_migrations') schemas.map! {|schema| schema.singularize.camelize} schemas.each do |schema| schemas.delete(schema) unless Object.const_get(schema).respond_to?(:state_machines) end schemas.sort end end def initialize(path) @path = File.expand_path(path, Rails.root) FileUtils.mkdir_p(@path) end def create(title, domain) options = { path: @path, name: title } Rails.application.eager_load! StateMachine::Machine.draw(domain, options) rescue => e Rails.logger.error(e) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
draw_smd-0.1.0 | app/models/draw_smd/diagram.rb |
draw_smd-0.0.1 | app/models/draw_smd/diagram.rb |