random_methods 0.0.5 → 0.0.6
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/random_methods.rb +22 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f834edccec8d3bc7e95b6ab42536495b3d02e2e
|
4
|
+
data.tar.gz: f12c2412d6363affefddcdd8ae1edf20c63ed4a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ab4a9fe7a52c90efe15fa1b85da0c2d2a43925ccbbf4c610f0465469bbc0a3332a607df1ea73d2c3651ce443d7237441da42a399e9b2cb39dfa6bd1200aee6e
|
7
|
+
data.tar.gz: 7e0c4c4d9c0df862704e58e7e628a949453d451fc4e310da00d8b54c6c02e6078c154ebca835fb9f611f41bf76854136adf0fa2b85c39cb82acbc69f4fb12091
|
data/lib/random_methods.rb
CHANGED
@@ -6,6 +6,18 @@ def quickWrite(file, item)
|
|
6
6
|
somefile.close
|
7
7
|
end
|
8
8
|
|
9
|
+
def scan_file(file, thing) # fix this thing
|
10
|
+
somefile = open(file, 'r')
|
11
|
+
somefile.each_line do |line|
|
12
|
+
if line[thing] then
|
13
|
+
return true
|
14
|
+
break
|
15
|
+
else
|
16
|
+
return false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
somefile.close
|
20
|
+
end
|
9
21
|
|
10
22
|
class Array
|
11
23
|
def puts_all
|
@@ -42,9 +54,9 @@ class Array
|
|
42
54
|
end
|
43
55
|
|
44
56
|
class String
|
45
|
-
#VITAL FOR
|
57
|
+
#VITAL FOR LINKS
|
46
58
|
# used for my webcrawling needs
|
47
|
-
domainEnd = ['.com', '.org', '.gov', '.mil', '.net', '.de', '.cr', '.cz', '.to', '.ca/'] # for some reason, 'gov' does not work
|
59
|
+
domainEnd = ['.com/', '.org/', '.gov/', '.mil/', '.net/', '.de/', '.cr/', '.cz/', '.to/', '.ca/'] # for some reason, 'gov' does not work
|
48
60
|
@@Domains = Regexp.union(domainEnd)
|
49
61
|
def half
|
50
62
|
strL = self.length
|
@@ -67,6 +79,13 @@ class String
|
|
67
79
|
return newString
|
68
80
|
end
|
69
81
|
|
82
|
+
def test_for(item)
|
83
|
+
if self[item] then
|
84
|
+
return true
|
85
|
+
else
|
86
|
+
return false
|
87
|
+
end
|
88
|
+
end
|
70
89
|
# made for link class
|
71
90
|
def index_domain # gives index of the domain ending
|
72
91
|
domainIndex = self.index(@@Domains)
|
@@ -82,10 +101,9 @@ class String
|
|
82
101
|
if domainIndex == nil then
|
83
102
|
return nil
|
84
103
|
else
|
85
|
-
domainEnd = domainIndex +
|
104
|
+
domainEnd = domainIndex + 3
|
86
105
|
domainName = self[0..domainEnd]
|
87
106
|
return domainName
|
88
107
|
end
|
89
108
|
end
|
90
|
-
|
91
109
|
end
|