module OptionsHelper

Public Instance Methods

compute_values(options = {}) click to toggle source

Internal: Recursively compute the value of a Hash if it responds to :call

options - The Hash options to compute value for

Returns the Hash with values computed if responding to :call

# File lib/message_queue/options_helper.rb, line 17
def compute_values(options = {})
  options.each do |k, v|
    if v.is_a?(Hash)
      compute_values(v)
    else
      options[k] = v.call if v.respond_to?(:call)
    end
  end
end
deep_clone(options = {}) click to toggle source

Internal: Deep clone a Hash. Compute the values in the Hash if responding to :call

options - The Hash options to clone

Returns the cloned Hash with values computed if responding to :call

# File lib/message_queue/options_helper.rb, line 7
def deep_clone(options = {})
  compute_values(options)
  Marshal.load(Marshal.dump(options)) # deep cloning options
end