Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/jsonapi_rspec/string.rb
Instance Method Summary collapse
-
#here_with_pipe!(delimeter = ' ') ⇒ String
Helper for the heredoc functionality.
Instance Method Details
#here_with_pipe!(delimeter = ' ') ⇒ String
Helper for the heredoc functionality. Allows pipe ‘|’ delimeted heredocs with a parameterized delimeter.
Example: html = <<-stop.here_with_pipe(delimeter=“n”)
|<!-- Begin: comment -->
|<script type="text/javascript">
stop html == ‘<!– Begin: comment –>n<script type=“text/javascript”>’
16 17 18 19 20 21 |
# File 'lib/jsonapi_rspec/string.rb', line 16 def here_with_pipe!(delimeter = ' ') lines = split("\n") lines.map! { |c| c.sub!(/\s*\|/, '') } new_string = lines.join(delimeter) replace(new_string) end |