Last active
December 28, 2016 02:13
-
-
Save tsmsogn/6052bf3e8931c39b0e9ad809d623badd to your computer and use it in GitHub Desktop.
[ruby]Output nested list with erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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