Project

General

Profile

Actions

Bug #12920

closed

Strange NoMethodError in Time.now

Added by kyanagi (Kouhei Yanagita) about 8 years ago. Updated about 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-11-10 trunk 56692) [x86_64-darwin15]
[ruby-core:78073]

Description

I got a strange NoMethodError in Time.now.

Integer.prepend(Module.new)
module Foo
  refine Integer do
    define_method(:+) { }
  end
end
Time.now
% ~/tmp/ruby-trunk/bin/ruby -v a.rb
ruby 2.4.0dev (2016-11-10 trunk 56692) [x86_64-darwin15]
a.rb:7:in `initialize': undefined method `+' for 1478773005000000000:Integer (NoMethodError)
	from a.rb:7:in `now'
	from a.rb:7:in `<main>'

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #12876: Calling new hangs Ruby when class prepends an empty module and makes initialize method publicClosedko1 (Koichi Sasada)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0