Skip to content

Commit 3884d32

Browse files
committed
Updates Ruby template for commas usage at end of line
Makes it so there are no commas for the last parameter in a function call, for more idiomatic Ruby.
1 parent 0ed3c1d commit 3884d32

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/exporters/ruby.tpl

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,28 @@ client = Elasticsearch::Client.new(
1111
{{#supportedApi}}
1212
{{#hasArgs}}
1313
response{{#if @index}}{{@index}}{{/if}} = client.{{this.api}}(
14+
{{#if this.body}}
1415
{{#each this.params}}
1516
{{alias @key ../this.request.path}}: "{{{this}}}",
1617
{{/each}}
1718
{{#each this.query}}
1819
{{alias @key ../this.request.query}}: {{{rubyprint this}}},
1920
{{/each}}
20-
{{#if this.body}}
2121
body: {{{rubyprint this.body}}}
22+
{{else}}
23+
{{#if this.query}}
24+
{{#each this.params}}
25+
{{alias @key ../this.request.path}}: "{{{this}}}",
26+
{{/each}}
27+
{{#each this.query}}
28+
{{alias @key ../this.request.query}}: {{{rubyprint this}}}{{#unless @last}},{{/unless}}
29+
{{/each}}
30+
{{else}}
31+
{{#each this.params}}
32+
{{alias @key ../this.request.path}}: "{{{this}}}"{{#unless @last}},{{/unless}}
33+
{{/each}}
2234
{{/if}}
35+
{{/if}}
2336
)
2437
{{else}}
2538
response{{#if @index}}{{@index}}{{/if}} = client.{{this.api}}

0 commit comments

Comments
 (0)