Class: Object

Inherits:
BasicObject
Defined in:
lib/tkxxs/conf.rb

Instance Method Summary collapse

Instance Method Details

#dup?Boolean

,dup,nil,Fixnum,can’t dup Fixnum

Potential solution for x = x.dup if x; x = x.is_a?(Fixnum) ? x : x.dup

From: comp.lang.ruby, Feb 17 2007, “Oppinions on RCR for dup on immutable classes”

Returns:

  • (Boolean)


22
23
24
25
26
# File 'lib/tkxxs/conf.rb', line 22

def dup? 
  dup # Better?: true
rescue TypeError 
  false 
end