Sha256: 6bfdc4c97f1b106c1e90f4245fa623ff3291b4eafd5325a31670aab1f2c35fb6

Contents?: true

Size: 447 Bytes

Versions: 5

Compression:

Stored size: 447 Bytes

Contents

class Array

  # generate params structure from array
  # return_array
  def extract_class! class_name

    if class_name.class != Class
      raise ArgumentError, "parameter must be a class name"
    end

    return_value= self.map { |element|
      if element.class == class_name
        element
      end
    }.uniq - [ nil ]
    return_value.each{|e| self.delete(e) }

    return return_value

  end unless method_defined? :extract_class!

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
loader-1.0.6 lib/loader/array.rb
loader-1.0.5 lib/loader/array.rb
loader-1.0.4 lib/loader/array.rb
loader-1.0.3 lib/loader/array.rb
loader-1.0.2 lib/loader/array.rb