Ruby create array form git log? -
i'm coding in ruby extract list of git authors using:
git log --since=#{from} --pretty="format:<author>%an</author>"
however, returns string so:
<author>first, last</author> <author>first, last</author> ...and forth down string...
how can split string array in ruby?
just use split split on newlines:
authors_string = `git log --since=#{from} --pretty="format:<author>%an</author>"` authors_array = authors_string.split($/)
i'm using $/
here holds line ending os.
Comments
Post a Comment