Skip to content

Instantly share code, notes, and snippets.

View haga-'s full-sized avatar

Heitor Almeida haga-

  • São Paulo - SP
  • 06:40 (UTC -03:00)
View GitHub Profile
# frozen_string_literal: true
require "active_support/core_ext/object/duplicable"
class Object
# Returns a deep copy of object if it's duplicable. If it's
# not duplicable, returns +self+.
#
# object = Object.new
# dup = object.deep_dup
#!/usr/bin/env ruby
class MegaGreeter
attr_accessor :names
# Create the object
def initialize(names = "World")
@names = names
end
0x2A7cA37316e589E2E58C610C41C76cf33E063f39
0xb4AaE55A71a023138E703216708BA78fb1281f18