class Trestle::Options

Public Class Methods

new(hash={}) click to toggle source
# File lib/trestle/options.rb, line 3
def self.new(hash={})
  self[hash]
end

Public Instance Methods

merge(other, &block) click to toggle source
# File lib/trestle/options.rb, line 7
def merge(other, &block)
  dup.merge!(other, &block)
end
merge!(other, &block) click to toggle source
Calls superclass method
# File lib/trestle/options.rb, line 11
def merge!(other, &block)
  super(other || {}) do |key, v1, v2|
    if v1.is_a?(Hash) && v2.is_a?(Hash)
      v1.merge(v2, &block)
    elsif v1.is_a?(Array)
      v1 + Array(v2)
    else
      v2
    end
  end
end