link_searcher 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/link_searcher.rb +22 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51558cbec2bd33edcabd5ccbc4edf7d68de2bd3b8c4c7f36ff3e79bc16d87cfc
|
4
|
+
data.tar.gz: b21f97b4ffdb3a0a33906e53d20933e9dfafe9bf0eb31541e34ec177b5988c31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba1854241576afb3c6d09a2a6eacab82491c349ab10c7f71b0595752ac8eab6cc53d4bde52f347ba5a35b0aef2fd60dc549f680e75c964139d4cebbcfab30425
|
7
|
+
data.tar.gz: e3fa45398c4ce1db525538802a7a222aa1bd325a0a811803ad834e38347e460be7e5d6ab1b5f00ba055693e2228d03701736b413e1af2e783198886d8a7aac80
|
data/lib/link_searcher.rb
CHANGED
@@ -2,7 +2,27 @@
|
|
2
2
|
|
3
3
|
# Main class
|
4
4
|
class LinkSearcher
|
5
|
-
|
5
|
+
attr_accessor :input_string
|
6
6
|
|
7
|
-
|
7
|
+
VERSION = '0.0.2'
|
8
|
+
HTTP_TOKKEN = 'http'
|
9
|
+
|
10
|
+
def initialize(input_string)
|
11
|
+
@input_string = input_string
|
12
|
+
end
|
13
|
+
|
14
|
+
def find_links
|
15
|
+
input_string.split(' ').filter_map do |word|
|
16
|
+
next unless word.include?(HTTP_TOKKEN)
|
17
|
+
|
18
|
+
trim_special_characters(word)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def trim_special_characters(link)
|
25
|
+
str = link.gsub('\n', '').gsub('\r', '')
|
26
|
+
str[-1] == ',' || str[-1] == '.' ? str.slice(0, str.length - 1) : str
|
27
|
+
end
|
8
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: link_searcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Leonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Parser for links
|
14
14
|
email: leonov7632@gmail.com
|