Project

General

Profile

Actions

Bug #17387

closed

About Warning.warn compatibility in Ruby 3.0.0

Added by jnchito (Junichi Ito) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.0preview2 (2020-12-08 master d7a16670c3) [x86_64-darwin20]
[ruby-core:101426]

Description

The sample code in https://docs.ruby-lang.org/ja/latest/method/Warning/s/warn.html does not work in Ruby 3.0.0. Is it intended behavior? I'm worrying about its compatibility.

warn "hoge"

module Warning
  def self.warn(*message)
    super(*message.map { |msg| msg.chomp + "!!!\n" })
  end
end

warn "hoge"
$ ruby ~/Desktop/test.rb
hoge
/Users/jnito/Desktop/test.rb:5:in `block in warn': undefined method `chomp' for {:category=>nil}:Hash (NoMethodError)
	from /Users/jnito/Desktop/test.rb:5:in `map'
	from /Users/jnito/Desktop/test.rb:5:in `warn'
	from <internal:warning>:43:in `warn'
	from /Users/jnito/Desktop/test.rb:9:in `<main>'

This issue must be related to https://bugs.ruby-lang.org/issues/17122


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #17122: Add category to Warning#warnClosedeileencodes (Eileen Uchitelle)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0