Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7685311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:13:23+00:00 2026-05-31T19:13:23+00:00

I readed State Machine Ruby README.md at github. I want to integrate SM with

  • 0

I readed State Machine Ruby README.md at github.

I want to integrate SM with my Rails application.

However I am curious about what that line does:

before_transition :parked => any - :parked, :do => :put_on_seatbelt

Particulary this fragment looks like ‘magic’ to me:

any - :parked,

Soo, you subtract symbol from some kind of object(s) return by any helper.
How it is suppose to work and what exactly it does this entire line(before_transition ...)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:13:24+00:00Added an answer on May 31, 2026 at 7:13 pm

    any is a singleton instance of the AllMathcher, which represents any state of your model. The minus (“-“) operator is actually an instance method of AllMatcher (reference here), which excludes the given state from the states of your model.

    Therefore, if your model has states of :running, :stopped, and :parked, then any - :parked just returns states :running and :stopped (:parked is excluded).

    And the meaning of the whole statement before_transition :parked => any - :parked, :do => :put_on_seatbelt is: before the model transits from :parked to any state but :parked, do the operation :put_on_seatbelt.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of Happstack.State MACID methods that I want to test using
I have a C#/WPF application with a tabbed interface that has been behaving strangely.
Readed bog of Ulrich Drepper and come across 2 entries that looks like conficting.
My app keeps track of the state of about 1000 objects. Those objects are
I've been asked to develop a new application that will work along side the
Suppose I have a daemon that is sharing it's internal state to various applications
I have an application that needs to delete a subkey tree and readd the
Google Reader and Gmail have scrollable divs that has a shadow on top if
i am creating rss reader application with php.it is basicly getting rss url's from
I am creating a Visual C# application to covert xml files to x12 edi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.