Sha256: 7bc3c8d05c72ef2caba39dc0faba88e3bd608409e5c4949665b9c228634784a3

Contents?: true

Size: 921 Bytes

Versions: 4

Compression:

Stored size: 921 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

4 entries across 4 versions & 1 rubygems

Version Path
ruby_core_extensions-0.4.0 lib/ruby_core_extensions/recursive/array.rb
ruby_core_extensions-0.3.0 lib/ruby_core_extensions/recursive/array.rb
ruby_core_extensions-0.2.0 lib/ruby_core_extensions/recursive/array.rb
ruby_core_extensions-0.1.0 lib/ruby_core_extensions/recursive/array.rb