Class: Array
Overview
Copyright 2010-2022 Ecsypno <www.ecsypno.com>
This file is part of the Arachni Framework project and is subject to
redistribution and commercial restrictions. Please see the Arachni Framework
web site for more information on licensing and terms of use.
  Instance Method Summary collapse
- #chunk(pieces = 2) ⇒ Object
 - 
  
    
      #includes_tags?(tags)  ⇒ Bool 
    
    
  
  
  
  
  
  
  
  
  
    
`true` if `self` contains any of the `tags` when objects of both `self` and `tags` are converted to `String`.
 - 
  
    
      #recode  ⇒ Array 
    
    
  
  
  
  
  
  
  
  
  
    
Recursively converts the array's string data to UTF8.
 - #recode! ⇒ Object
 
Instance Method Details
#chunk(pieces = 2) ⇒ Object
      38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54  | 
    
      # File 'lib/arachni/ruby/array.rb', line 38 def chunk( pieces = 2 ) return self if pieces <= 0 len = self.length mid = len / pieces chunks = [] start = 0 1.upto( pieces ) do |i| last = start + mid last = last - 1 unless len % pieces >= i chunks << self[ start..last ] || [] start = last + 1 end chunks end  | 
  
#includes_tags?(tags) ⇒ Bool
Returns `true` if `self` contains any of the `tags` when objects of both `self` and `tags` are converted to `String`.
      16 17 18 19 20 21 22 23  | 
    
      # File 'lib/arachni/ruby/array.rb', line 16 def ( ) return false if ! = [].flatten.compact.map( &:to_s ) return false if .empty? (self.flatten.compact.map( &:to_s ) & ).any? end  | 
  
#recode ⇒ Array
Recursively converts the array's string data to UTF8.
      29 30 31  | 
    
      # File 'lib/arachni/ruby/array.rb', line 29 def recode map { |v| v.respond_to?( :recode ) ? v.recode : v } end  | 
  
#recode! ⇒ Object
      33 34 35 36  | 
    
      # File 'lib/arachni/ruby/array.rb', line 33 def recode! each { |v| v.recode! if v.respond_to?( :recode! ) } self end  |