Skip to content

Commit 7553d8b

Browse files
authored
Update README.md
1 parent 3c48f26 commit 7553d8b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A CLI tool written in rust that converts embedded ruby (.erb) templates into emb
44
- Replacing @ with $ inside template tags
55
- Converting if, elsif, else, and end into proper .epp blocks with curly brackets
66
- Converting simple .each loops into proper .epp
7+
- Converting complex .each loops that iterate through empty hashes (with || {}) by adding an if
78
- Preserving optional whitespace trimmers (<%- and -%>)
89
- Leaving @ outside tags (like in email addresses) unchanged
910
- Converting versioncmp fn into proper .epp
@@ -43,6 +44,10 @@ input.erb
4344
Do Something
4445
<% end %>
4546
47+
<%- (@var['thing1']['thing2']['thing3'] || {}).each do | x | -%>
48+
Thing =<%= x['thing'] %>
49+
<% end -%>
50+
4651
4752
```
4853
output.epp
@@ -66,6 +71,12 @@ output.epp
6671
Do Something
6772
<% } %>
6873
74+
<%- if ('thing1' in $var) and ('thing2' in $var['thing1']) and ('thing3' in $var['thing1']['thing2']) and ($var['thing1']['thing2']['thing3'] =~ Array) { -%>
75+
<%- $var['thing1']['thing2']['thing3'].each | $x | { -%>
76+
Thing =<%= $x['thing'] %>
77+
<% } -%>
78+
<%- } -%>
79+
6980
7081
```
7182

0 commit comments

Comments
 (0)