Skip to content

Instantly share code, notes, and snippets.

Created August 21, 2015 01:06
Show Gist options
  • Save anonymous/ca39d53313634a42546f to your computer and use it in GitHub Desktop.
Save anonymous/ca39d53313634a42546f to your computer and use it in GitHub Desktop.
YAML
success:
- active
- enabled
warning
- rejected
- blocked
# Of course this array can be very big with many other status
# This generates the hash { 'success' => ['active', 'enabled'], 'warning' => ['rejected', 'blocked'] }
# What I want to achieve is actually :
{ 'active' => 'success', 'enabled' => 'success', 'rejected' => 'warning', 'blocked' => 'warning' }
# Is there any way to achieve that, using only YAML syntax and not repeating the values like so:
YAML
enabled: 'success'
active: 'success'
rejected: 'warning'
blocked: 'warning'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment