Giter VIP home page Giter VIP logo

flow_machine's People

Contributors

danhodos avatar jhanggi avatar petebrooks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mistersourcerer

flow_machine's Issues

Invalid events should raise rather than failing silently?

Currently, if we call an event on the workflow object that doesn't exists in the current state, we get a no-op false return value rather than a NotMethodError or something similar. Could it be more handy for the development environment to raise an exception here to help track down bad code paths (a caller that is trying to do a wrong transition on a specific scenario) instead? Even if the client code checks for falsy return values there is no way to know that an invalid transition/event was called.

Here is a piece of code to illustrate the scenario:

class PublishingWorkflow
  include FlowMachine::Workflow

  state DraftState
  state PublishedState
end

class DraftState < FlowMachine::WorkflowState
  event :publish do
    transition to: :published
  end
end

class PublishedState < FlowMachine::WorkflowState
  event :retract do
    transition to: :retracted
  end
end

workflow = PublishingWorkflow.new(BlogPost.new(state: :draft))
# drafts can't be retracted.
workflow.retract! #=> false

Instance variable not initialized warnings

When config.warnings = true in spec_helper is enabled, there are several warnings about uninialized instance variables.

flow_machine/lib/flow_machine/workflow.rb:67: warning: instance variable @state_attribute not initialized
flow_machine/lib/flow_machine/workflow.rb:162: warning: instance variable @previous_state not initialized

Deprecate FlowMachine::Factory

Deprecate the methods in FlowMachine::Factory in favor of having them straight on FlowMachine

Example:
Previous: FlowMachine::Factory.workflow_for(...)
New: FlowMachine.workflow_for(...)

And add notes about these methods to the README.

Remove dependency on ActiveSupport

Currently, there are a few places where we are using ActiveSupport: try, delegate, Inflectors, and extract_options!. Ideally these would not be used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.