Skip to content

Instantly share code, notes, and snippets.

@tsmsogn
Last active December 28, 2016 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsmsogn/6052bf3e8931c39b0e9ad809d623badd to your computer and use it in GitHub Desktop.
Save tsmsogn/6052bf3e8931c39b0e9ad809d623badd to your computer and use it in GitHub Desktop.
[ruby]Output nested list with erb
require 'erb'
MY_CATEGORIES = <<SPEC
Fun
<%= ERB.new(FUN, nil, '-').result(binding) -%>
Work
<%= ERB.new(WORK, nil, '-').result(binding) -%>
SPEC
FUN = <<SPEC
Sport
<%= ERB.new(SPORT, nil, '-').result(binding) -%>
Friends
SPEC
SPORT = <<SPEC
Surfing
Extreme knitting
SPEC
WORK = <<SPEC
Reports
<%= ERB.new(REPORT, nil, '-').result(binding) -%>
Trips
SPEC
REPORT = <<SPEC
Annual
Status
SPEC
puts ERB.new(MY_CATEGORIES, nil, '-').result(binding)
# Fun
# Sport
# Surfing
# Extreme knitting
# Friends
# Work
# Reports
# Annual
# Status
# Trips
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment