class Hash

Public Instance Methods

deep_merge(other_hash, &block) click to toggle source
# File lib/itamae-spec/task/base.rb, line 11
def deep_merge(other_hash, &block)
  dup.deep_merge!(other_hash, &block)
end
deep_merge!(other_hash) { |key, this_val, other_val| ... } click to toggle source
# File lib/itamae-spec/task/base.rb, line 15
def deep_merge!(other_hash, &block)
  merge!(other_hash) do |key, this_val, other_val|
    if this_val.is_a?(Hash) && other_val.is_a?(Hash)
      this_val.deep_merge(other_val, &block)
    elsif block_given?
      yield(key, this_val, other_val)
    else
      other_val
    end
  end
end
to_pretty_json() click to toggle source
# File lib/itamae-spec/task/base.rb, line 27
def to_pretty_json
  MultiJson.dump(self, symbolize_keys: true, pretty: true)
end