Module: Ruborithms::Algorithms::LinearSearch::ClassMethods
- Defined in:
- lib/ruborithms/algorithms/linear_search.rb
Instance Method Summary collapse
Instance Method Details
#linear_search(object, value) ⇒ Object
11 12 13 14 15 |
# File 'lib/ruborithms/algorithms/linear_search.rb', line 11 def linear_search(object, value) object.each_with_index do |item, index| return index if value == item end end |