Module: GraphQL::Language::Comment
- Defined in:
- lib/graphql/language/comment.rb
Class Method Summary collapse
-
.print(str, indent: '') ⇒ Object
: (String str, ?indent: String) -> String.
Class Method Details
.print(str, indent: '') ⇒ Object
: (String str, ?indent: String) -> String
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/graphql/language/comment.rb', line 8 def self.print(str, indent: '') lines = str.split("\n").map do |line| comment_str = "".dup comment_str << indent comment_str << "# " comment_str << line comment_str.rstrip end lines.join("\n") + "\n" end |