Sha256: 63c95ec18e09b1aa01f1542c64df4f2bac848dabc92f4df36651da1134c8ee96

Contents?: true

Size: 428 Bytes

Versions: 3

Compression:

Stored size: 428 Bytes

Contents

# encoding: utf-8

module Nanoc3::ArrayExtensions

  def symbolize_keys
    inject([]) do |array, element|
      array + [ element.respond_to?(:symbolize_keys) ? element.symbolize_keys : element ]
    end
  end

  def stringify_keys
    inject([]) do |array, element|
      array + [ element.respond_to?(:stringify_keys) ? element.symbolize_keys : element ]
    end
  end

end

class Array
  include Nanoc3::ArrayExtensions
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc3-3.0.2 lib/nanoc3/base/core_ext/array.rb
nanoc3-3.0.1 lib/nanoc3/base/core_ext/array.rb
nanoc3-3.0.0 lib/nanoc3/base/core_ext/array.rb