Sha256: ed5ad68b803ed7e67eb639bb7ccc092651422151cf857c50532e6e2de7ec7abc

Contents?: true

Size: 332 Bytes

Versions: 4

Compression:

Stored size: 332 Bytes

Contents

module Trestle
  class Options < Hash
    def self.new(hash={})
      self[hash]
    end

    def merge(other)
      dup.merge!(other)
    end

    def merge!(other)
      deep_merge!(other || {}) do |key, v1, v2|
        if v1.is_a?(Array)
          v1 + Array(v2)
        else
          v2
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trestle-0.8.4 lib/trestle/options.rb
trestle-0.8.3 lib/trestle/options.rb
trestle-0.8.2 lib/trestle/options.rb
trestle-0.8.0 lib/trestle/options.rb