Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/rggen/core_extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#find_by(conditions) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/rggen/core_extensions/array.rb', line 2

def find_by(conditions)
  find do |i|
    conditions.all? do |key, value|
      i.respond_to?(key) && (i.__send__(key) == value)
    end
  end
end