diff options
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/duplicable.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/duplicable.rb b/activesupport/lib/active_support/core_ext/duplicable.rb new file mode 100644 index 0000000000..adbbfd8c60 --- /dev/null +++ b/activesupport/lib/active_support/core_ext/duplicable.rb @@ -0,0 +1,37 @@ +class Object + # Can you safely .dup this object? + # False for nil, false, true, symbols, and numbers; true otherwise. + def duplicable? + true + end +end + +class NilClass #:nodoc: + def duplicable? + false + end +end + +class FalseClass #:nodoc: + def duplicable? + false + end +end + +class TrueClass #:nodoc: + def duplicable? + false + end +end + +class Symbol #:nodoc: + def duplicable? + false + end +end + +class Numeric #:nodoc: + def duplicable? + false + end +end |