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
12 13 14 15 16 |
# File 'lib/ruborithms/algorithms/linear_search.rb', line 12 def linear_search(object, value) object.each_with_index do |item, index| return index if value == item end end |