mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #6361 from markmcspadden/issue_6265
Remove special cases for duplicable? on Class and Module
This commit is contained in:
commit
6950d74e18
2 changed files with 2 additions and 26 deletions
|
@ -81,30 +81,6 @@ class Numeric
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Class
|
|
||||||
# Classes are not duplicable:
|
|
||||||
#
|
|
||||||
# c = Class.new # => #<Class:0x10328fd80>
|
|
||||||
# c.dup # => #<Class:0x10328fd80>
|
|
||||||
#
|
|
||||||
# Note +dup+ returned the same class object.
|
|
||||||
def duplicable?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Module
|
|
||||||
# Modules are not duplicable:
|
|
||||||
#
|
|
||||||
# m = Module.new # => #<Module:0x10328b6e0>
|
|
||||||
# m.dup # => #<Module:0x10328b6e0>
|
|
||||||
#
|
|
||||||
# Note +dup+ returned the same module object.
|
|
||||||
def duplicable?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
require 'bigdecimal'
|
require 'bigdecimal'
|
||||||
class BigDecimal
|
class BigDecimal
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -5,8 +5,8 @@ require 'active_support/core_ext/numeric/time'
|
||||||
|
|
||||||
class DuplicableTest < ActiveSupport::TestCase
|
class DuplicableTest < ActiveSupport::TestCase
|
||||||
RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, 5.seconds]
|
RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, 5.seconds]
|
||||||
YES = ['1', Object.new, /foo/, [], {}, Time.now]
|
YES = ['1', Object.new, /foo/, [], {}, Time.now, Class.new, Module.new]
|
||||||
NO = [Class.new, Module.new]
|
NO = []
|
||||||
|
|
||||||
begin
|
begin
|
||||||
bd = BigDecimal.new('4.56')
|
bd = BigDecimal.new('4.56')
|
||||||
|
|
Loading…
Reference in a new issue