Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow multiple states to be defined on one line #288

Merged
merged 3 commits into from
Mar 19, 2016

Conversation

HParker
Copy link
Contributor

@HParker HParker commented Dec 2, 2015

resolves #146

I don't know if anyone still wants it, but it was straight forward enough to add.

I hope you don't mind I coopted the first example in the readme to show the new syntax. I am happy to change that if you prefer it done differently.

Question: The issue also mentioned being able to refer to multiple states by states rather than state in the aasm block, however states as defined in base is already accessible from that scope as we just instance_eval the block against the base class. I was wondering if you would be open to scoping the methods that are callable from the aasm block to some subset of the methods in base. I am happy to create an issue and take a look.

@alto alto self-assigned this Feb 5, 2016
@alto
Copy link
Member

alto commented Feb 5, 2016

@HParker Thanks for the pull request, which looks great so far (and I'm looking forward to merge it). A couple of things though:

  1. could you please merge the current master back into your fork?
  2. could you please create another ticket for the states change you mentioned? (it seems like this is getting a DSL change)

Regarding the README, I'm happy to take your change (and maybe add a comment later).

if args.last.is_a?(Hash) && args.size == 2
names = [args.first]
options = args.last
elsif
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a condition missing here?

@rousisk
Copy link

rousisk commented Feb 5, 2016

looks good, thanks @HParker - will definitely use that when merged :-)

HParker added 2 commits March 15, 2016 19:05
…_line

- also fix typo and move arg deconstruction to private method
@HParker
Copy link
Contributor Author

HParker commented Mar 16, 2016

@alto and @rousisk Sorry for the delay!

Should be updated I am really confused how the tests were passing before with that missing case in the if ... elsif ... else. Hopefully everything should be working now. Let me know if you have any additional feedback.

@alto alto merged commit e040b64 into aasm:master Mar 19, 2016
alto added a commit that referenced this pull request Mar 19, 2016
@alto
Copy link
Member

alto commented Mar 30, 2016

I just released version 4.10.0 including your changes.

@HParker HParker deleted the add_states_on_one_line branch March 26, 2017 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for multiple state definitions in one line (states :sleeping, :running, :cleaning)
3 participants