Sha256: f7a4c43c71d0c2805be7b45066bf724e588aba481de83888b4caa90ae00ea039

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 Bytes

Contents

 class Array 
   
  def convert
    self
  end

  def convert_keys_recursively(&converter)
    map { |v| v.convert_keys_recursively(&converter) }
  end
  
  def convert_values_recursively(&converter)
    map { |v| v.convert_values_recursively(&converter) }
  end
  
  def symbolize_keys_recursively
    map(&:symbolize_keys_recursively)
  end
  
  def stringify_values_recursively
    map(&:stringify_values_recursively)
  end
  
  def make_indifferent_access_recursively
    map(&:make_indifferent_access_recursively)
  end
  
  def recursive_blank?
    each do |v|
      if v.respond_to?(:recursive_blank?)
        return false unless v.recursive_blank?
      else
        return false unless v.blank?
      end
    end
    true
  end
  
  def recursively(&block)
    each do |element|
      block.call(element)
      element.recursively(&block) if element.respond_to?(:recursively)
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_core_extensions-0.0.1 lib/ruby_core_extensions/recursive/array.rb