Module: GraphQL::Language::Comments
Instance Method Summary collapse
Instance Method Details
#commentize(description, indent: '') ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/graphql/language/comments.rb', line 7 def commentize(description, indent: '') lines = description.split("\n") comment = ''.dup lines.each do |line| if line == '' comment << "#{indent}#\n" else sublines = break_line(line, 120 - indent.length) sublines.each do |subline| comment << "#{indent}# #{subline}\n" end end end comment end |