Sha256: 2203c51aefc85526051cb6dd955bc3a1fe314bc9adc20368a7e47f52ac5407f9

Contents?: true

Size: 438 Bytes

Versions: 28

Compression:

Stored size: 438 Bytes

Contents

module Locomotive
  module Wagon

    module YamlExt

      def self.transform(hash, &block)
        return if hash.blank? || !hash.respond_to?(:has_key?)

        hash.each do |key, value|
          case value
          when Hash   then transform(value, &block)
          when Array  then value.each { |v| transform(v, &block) }
          when String then hash[key] = yield(value)
          end
        end
      end

    end

  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
locomotivecms_wagon-3.2.0.alpha2 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.2.0.alpha1 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.1.1 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.1.0 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.1.0.beta1 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.0.5 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.0.4 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.0.3 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.0.2 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.0.0 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.0.0.rc0 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-3.0.0.beta2 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-2.4.1 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-2.4.0 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-2.4.0.rc2 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-2.4.0.rc1 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-2.3.0 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-2.3.0.rc1 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-2.2.0 lib/locomotive/wagon/tools/yaml_ext.rb
locomotivecms_wagon-2.2.0.rc3 lib/locomotive/wagon/tools/yaml_ext.rb