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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -