PageRenderTime 52ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/jruby-1.4.0/share/ri/1.8/system/String/gsub-i.yaml

https://github.com/expectedbehavior/testing_talk_demo
YAML | 23 lines | 21 code | 2 blank | 0 comment | 0 complexity | 10f713f07b6e7df15882336a58729949 MD5 | raw file
Possible License(s): CPL-1.0, AGPL-1.0, LGPL-2.1, JSON, GPL-3.0
  1. --- !ruby/object:RI::MethodDescription
  2. aliases: []
  3. block_params:
  4. comment:
  5. - !ruby/struct:SM::Flow::P
  6. body: Returns a copy of <em>str</em> with <em>all</em> occurrences of <em>pattern</em> replaced with either <em>replacement</em> or the value of the block. The <em>pattern</em> will typically be a <tt>Regexp</tt>; if it is a <tt>String</tt> then no regular expression metacharacters will be interpreted (that is <tt>/\d/</tt> will match a digit, but <tt>'\d'</tt> will match a backslash followed by a 'd').
  7. - !ruby/struct:SM::Flow::P
  8. body: If a string is used as the replacement, special variables from the match (such as <tt>$&amp;</tt> and <tt>$1</tt>) cannot be substituted into it, as substitution into the string occurs before the pattern match starts. However, the sequences <tt>\1</tt>, <tt>\2</tt>, and so on may be used to interpolate successive groups in the match.
  9. - !ruby/struct:SM::Flow::P
  10. body: In the block form, the current match string is passed in as a parameter, and variables such as <tt>$1</tt>, <tt>$2</tt>, <tt>$`</tt>, <tt>$&amp;</tt>, and <tt>$'</tt> will be set appropriately. The value returned by the block will be substituted for the match on each call.
  11. - !ruby/struct:SM::Flow::P
  12. body: The result inherits any tainting in the original string or any supplied replacement string.
  13. - !ruby/struct:SM::Flow::VERB
  14. body: " &quot;hello&quot;.gsub(/[aeiou]/, '*') #=&gt; &quot;h*ll*&quot;\n &quot;hello&quot;.gsub(/([aeiou])/, '&lt;\\1&gt;') #=&gt; &quot;h&lt;e&gt;ll&lt;o&gt;&quot;\n &quot;hello&quot;.gsub(/./) {|s| s[0].to_s + ' '} #=&gt; &quot;104 101 108 108 111 &quot;\n"
  15. full_name: String#gsub
  16. is_singleton: false
  17. name: gsub
  18. params: |
  19. str.gsub(pattern, replacement) => new_str
  20. str.gsub(pattern) {|match| block } => new_str
  21. visibility: public