Sha256: a653c830a52329a11f89284bee8943b98b4c5c4c60eaf9655dc5d032e5be1fdb

Contents?: true

Size: 624 Bytes

Versions: 11

Compression:

Stored size: 624 Bytes

Contents

# = Duplicable
#
# This is not a mixin, since nearly all objects have this baehavior.
#
# Is this the same as immutable? Whould that be a better name?

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

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
facets-2.6.0 lib/more/facets/duplicable.rb
facets-2.4.0 lib/facets/duplicable.rb
facets-2.4.1 lib/facets/duplicable.rb
facets-2.4.4 lib/more/facets/duplicable.rb
facets-2.4.2 lib/more/facets/duplicable.rb
facets-2.4.3 lib/more/facets/duplicable.rb
facets-2.4.5 lib/more/facets/duplicable.rb
facets-2.5.0 lib/more/facets/duplicable.rb
facets-2.5.1 lib/more/facets/duplicable.rb
facets-2.5.2 lib/more/facets/duplicable.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/more/facets/duplicable.rb