Method: Hanami::Utils::LoadPaths#initialize_copy

Defined in:
lib/hanami/utils/load_paths.rb

#initialize_copy(original) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

It specifies the policy for initialize copies of the object, when #clone or #dup are invoked.

Examples:

require 'hanami/utils/load_paths'

paths  = Hanami::Utils::LoadPaths.new '.'
paths2 = paths.dup

paths  << '..'
paths2 << '../..'

paths
  # => #<Hanami::Utils::LoadPaths:0x007f84e0cad430 @paths=[".", ".."]>

paths2
  # => #<Hanami::Utils::LoadPaths:0x007faedc4ad3e0 @paths=[".", "../.."]>

See Also:

Since:

  • 0.2.0



49
50
51
# File 'lib/hanami/utils/load_paths.rb', line 49

def initialize_copy(original)
  @paths = original.instance_variable_get(:@paths).dup
end