Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

aasm_mermaid

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aasm_mermaid


Version published
Maintainers
1
Created
Source

AASMMermaid

Generate Mermaid diagrams from AASM state machines.

Installation

Add this line to your application's Gemfile:

gem 'aasm_mermaid'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install aasm_mermaid

Usage

for an example AASM:

class TestAASMParentClass
  include AASM
  attr_accessor :state

  aasm do
    state :sleeping, initial: true
    state :running, :cleaning

    event :run do
      transitions from: :sleeping, to: :running
    end

    event :clean do
      transitions from: :running, to: :cleaning
    end

    event :sleep do
      transitions from: %i[running cleaning], to: :sleeping
    end

    event :procrastinate do
      transitions to: :sleeping
    end
  end
end

generate the diagram with:

AASMMermaid.generate_diagram_for(aasm: TestAASMParentClass.aasm)

result (rendered by github):

stateDiagram-v2
  sleeping --> running : run
  running --> cleaning : clean
  running --> sleeping : sleep
  cleaning --> sleeping : sleep
  sleeping --> sleeping : procrastinate
  running --> sleeping : procrastinate
  cleaning --> sleeping : procrastinate

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/iiwo/aasm_mermaid. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the AASMMermaid project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 22 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc