diff options
| author | Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com> | 2023-10-27 18:14:51 +0300 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-10-30 14:15:47 +0000 |
| commit | 1d51e4cadfbc1f445d00887189e06047759c9aec (patch) | |
| tree | bfccd69e3e1eac646a6f00bb768b8d6dc514f0ed /test/ruby/test_lambda.rb | |
| parent | ab4781b64d945e962575f2eac20b72185235d23b (diff) | |
[ruby/prism] Improve comment generation in templates
The existing comment generation was hard to read and was making a lot of string manipulation. However, ERB files are already designed to do string manipulation, so we can use that instead.
So, instead of doing a split and a map, I opted to use the `#each_line` method to iterate over the lines of the file.
Also, in order to add an optional space padding at the beginning of the line, I opted to pad it with a space and to then right trim it. This makes sure that no space is left behind if the line is empty, but a space is added if the line is not empty.
https://github.com/ruby/prism/commit/5736711e70
Diffstat (limited to 'test/ruby/test_lambda.rb')
0 files changed, 0 insertions, 0 deletions
