"Fossies" - the Fresh Open Source Software Archive

Member "asciidoctor-2.0.10/lib/asciidoctor/core_ext/hash/merge.rb" (1 Jun 2019, 371 Bytes) of package /linux/www/asciidoctor-2.0.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # frozen_string_literal: true
    2 # NOTE remove once minimum required Ruby version is at least 2.6
    3 # NOTE use `send :prepend` to be nice to Ruby 2.0
    4 Hash.send :prepend, (Module.new do
    5   def merge *args
    6     (len = args.length) < 1 ? super({}) : (len > 1 ? args.inject(self) {|acc, arg| acc.merge arg } : (super args[0]))
    7   end
    8 end) if (Hash.instance_method :merge).arity == 1