aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/rubocops
diff options
context:
space:
mode:
authorGautham Goli2017-05-13 18:44:37 +0530
committerGautham Goli2017-05-13 18:48:40 +0530
commit80572939b4ba691e6dc754e1151dd46ac5dcbca4 (patch)
tree8d5e52e13a50ff7e9586e7aaf39bcaa86582002a /Library/Homebrew/rubocops
parent459fef3b09b25d3e24cce6aa6f2e3a7bd5460a2b (diff)
downloadbrew-80572939b4ba691e6dc754e1151dd46ac5dcbca4.tar.bz2
Update string_content method to support multiline strings, add test for same
Diffstat (limited to 'Library/Homebrew/rubocops')
-rw-r--r--Library/Homebrew/rubocops/extend/formula_cop.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index 4120be6ef..3f70086b3 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -180,9 +180,10 @@ module RuboCop
node.source_range.source_buffer
end
- # Returns the string representation if node is of type str
+ # Returns the string representation if node is of type str(plain) or dstr(interpolated)
def string_content(node)
- node.str_content if node.type == :str
+ return node.str_content if node.type == :str
+ node.each_child_node(:str).map(&:str_content).join("") if node.type == :dstr
end
# Returns printable component name