searchractor 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/searchractor.rb +22 -0
  3. metadata +19 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c214730fc323757a97bb2bf3c7760dac861ae0f5f5bcf1aedd8656552a31b9ce
4
- data.tar.gz: 784c9987987134e1b8c72d9edd5368b77f3b7ee0574194b03d680d6449fbfe64
3
+ metadata.gz: 3d2bcb48aada124d03d8f11fec74b29f74681cae146e5a62fa6416c9a5e0a51a
4
+ data.tar.gz: 4cfa23587fae050ce4a705c0051aeb43021a6f1c32a8dff1cd1d7d35100a7847
5
5
  SHA512:
6
- metadata.gz: c01be6db48044ac64ba9e551d373c3e3c95eb8d509f1841b973d474c22418da742747bf8536cbbc51c0e5a9501bd0a6d7bb0a0bc17befab45fe179fa219a5934
7
- data.tar.gz: 535aa5e228fe6a8407a104228003f88e654a4fe3e998154b9ad0256de11cbaef072c8f26e82fc76653aa08ec07859f5fa5d10a098cae789568800c7850685685
6
+ metadata.gz: 26d664d4c1edc024e297bae8cf28955ba642c26b7694d2974fb11be6b29f4d67f93178d8538e21675d6131643a3deb8c783538743ebae094d2ba25fc650654bb
7
+ data.tar.gz: d525bee4c18c897ab86f3dd0234dd8c7d8866c9c39ef22ccc9e22131d68c37ba28c4a6725c9ba54580725b680c44384eae45dfe5abd2858eff4e669877fe9238
data/lib/searchractor.rb CHANGED
@@ -49,5 +49,27 @@ module Searchractor
49
49
  end
50
50
  end
51
51
  end
52
+
53
+ # Public: Use linear search to look for an element in an initialized list of elements.
54
+ #
55
+ # Examples:
56
+ #
57
+ # searchable = SearchractorClass.new([1, 4, 3, 8, 6])
58
+ #
59
+ # searchable.l_search(3) => 2
60
+ #
61
+ # searchable.l_search(10) => nil
62
+ #
63
+ # Returns either the index of the searched element or nil if the element is not found
64
+ # in the list
65
+ def l_search(element)
66
+ i = 0
67
+
68
+ while i <= list.length - 1
69
+ i += 1
70
+
71
+ return i if element == list[i]
72
+ end
73
+ end
52
74
  end
53
75
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Caltram
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-11 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2024-03-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description:
14
28
  email:
15
29
  executables: []
@@ -35,9 +49,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
35
49
  - !ruby/object:Gem::Version
36
50
  version: '0'
37
51
  requirements: []
38
- rubygems_version: 3.4.10
52
+ rubygems_version: 3.5.3
39
53
  signing_key:
40
54
  specification_version: 4
41
- summary: A module dedicated to search algorithms studies in Ruby base on interactor's
55
+ summary: A module dedicated to search algorithms studies in Ruby based on interactor's
42
56
  architecture
43
57
  test_files: []