Module: Mutant::Helper

Defined in:
lib/mutant/helper.rb

Overview

Module for support methods

They would normally be defined on the root namespace. But it is easier to create the Zombie when there are no References to the root namespace name within the library.

Class Method Summary collapse

Class Method Details

.deep_clone(object) ⇒ 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.

Return deep clone of object

Parameters:

  • object (Object)

Returns:

  • (Object)

    object



18
19
20
# File 'lib/mutant/helper.rb', line 18

def self.deep_clone(object)
  Marshal.load(Marshal.dump(object))
end

.extract_option(options, key) ⇒ 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.

Extract option from options hash

Parameters:

  • options (Hash)
  • key (Object)

Returns:

  • (Object)

    value



31
32
33
34
35
# File 'lib/mutant/helper.rb', line 31

def self.extract_option(options, key)
  options.fetch(key) do
    raise ArgumentError,"Missing #{key.inspect} in options"
  end
end