summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb2
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb
index f0fda9bdbc..9e4da5ef0d 100644
--- a/ext/psych/lib/psych/visitors/to_ruby.rb
+++ b/ext/psych/lib/psych/visitors/to_ruby.rb
@@ -36,7 +36,7 @@ module Psych
unless @domain_types.empty? || !target.tag
key = target.tag.sub(/^[!\/]*/, '').sub(/(,\d+)\//, '\1:')
- key = "tag:#{key}" unless key =~ /^(?:tag:|x-private)/
+ key = "tag:#{key}" unless key.match?(/^(?:tag:|x-private)/)
if @domain_types.key? key
value, block = @domain_types[key]
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index a2ebc4d781..e27c927996 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -261,7 +261,7 @@ module Psych
style = Nodes::Scalar::LITERAL
plain = false
quote = false
- elsif o =~ /\n(?!\Z)/ # match \n except blank line at the end of string
+ elsif o.match?(/\n(?!\Z)/) # match \n except blank line at the end of string
style = Nodes::Scalar::LITERAL
elsif o == '<<'
style = Nodes::Scalar::SINGLE_QUOTED
@@ -272,9 +272,9 @@ module Psych
style = Nodes::Scalar::DOUBLE_QUOTED
elsif @line_width && o.length > @line_width
style = Nodes::Scalar::FOLDED
- elsif o =~ /^[^[:word:]][^"]*$/
+ elsif o.match?(/^[^[:word:]][^"]*$/)
style = Nodes::Scalar::DOUBLE_QUOTED
- elsif not String === @ss.tokenize(o) or /\A0[0-7]*[89]/ =~ o
+ elsif not String === @ss.tokenize(o) or /\A0[0-7]*[89]/.match?(o)
style = Nodes::Scalar::SINGLE_QUOTED
end