Skip to content

Instantly share code, notes, and snippets.

@cadwallion
Created October 6, 2012 23:39
Show Gist options
  • Save cadwallion/3846523 to your computer and use it in GitHub Desktop.
Save cadwallion/3846523 to your computer and use it in GitHub Desktop.
YAML Equipment config
require 'yaml'
equipment = YAML.load_file('equipment.yml')
weapons = equipment['weapons']
armor = equipment['armor']
puts weapons[1][1] # => { 'name' => 'Long Sword', 'damage' => 7 }
weapons:
1:
- name: 'Short Sword'
damage: 5
- name: 'Long Sword'
damage: 7
armor:
2:
- name: 'Leather Helm'
slot: 'head'
armor: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment