This code is what mean

A lot of grammar ah, do not understand, ask


<% branch = File.exist?('../.git') ? ('_' <<`git status`.scan(/\# On branch ([^\s]+?)$/).flatten.first.sub(/^local\-/, '').sub('-', '_')) : '' %>

Started by Phil at November 14, 2016 - 8:57 PM

Translation: if the file exists? Exist on how processing: does not exist on how.

? : Grammar is equivalent to if else syntax

Intermediate processing is regular expressions matching and substitution

Posted by Ariel at November 26, 2016 - 9:34 PM

Check the GIT branch

From the code, is the Erb statement. Data processing logic should be separated and show.

Posted by Verne at November 28, 2016 - 9:56 PM