blackstack_commons 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70a80ef69b1f559548bf1b9a5200bef942849a59
4
- data.tar.gz: 912b1b9564750ad842219ea1caff941269dd1779
3
+ metadata.gz: ec568d7826d4df83d2b78a3676e7e8a59f0f2e07
4
+ data.tar.gz: 0f7c18e354d129fd65f7338d3268d2ae6f870d94
5
5
  SHA512:
6
- metadata.gz: 5f6d50eef3b92f6d230ec2bcf0465d645da6eecf5783aff358a55a17a444414a44ccf5907efad0971859ecb0128f7083fc6c870703df3de0369def02da9d7982
7
- data.tar.gz: d99124b3868f30b715032814496eb542f11ef625dc761a3db21542dc35a1a6f1e4695621c036abb2156dae328c99d6983bb84ca216d2726fa9c20bab50218724
6
+ metadata.gz: 1dc832b9d3dc5b5d58044e016a1b4bb50d19b0ee2742ce6317e77735b6cc48b7303a8e4c74236b3c768df5029057a7dcbb0b3b5ae986e9f9957e991938eb05d0
7
+ data.tar.gz: 56a5564c6f399ddbbf9ec260ab17dca4ddde08af67c7a93f965e269dbe61722a7db7cb1eef77daa99695b7c25c8457058d1fe202240aa251b0e76d6347cc668f
@@ -13,10 +13,13 @@ a.each { |s|
13
13
  puts ""
14
14
  puts "GUIDs"
15
15
  a = [
16
+ '{{331a92c3-5fe1-47a2-a31b-cfa439b5b4f9}',
16
17
  '{331a92c3-5fe1-47a2-a31b-cfa439b5b4f9}',
17
18
  '331a92c3-5fe1-47a2-a31b-cfa439b5b4f9',
18
19
  '{331A92C3-5FE1-47A2-A31B-CFA439B5B4F9}',
20
+ '{331A92C3-5FE1-47A2-A31B-CFA439B5B4F9}}',
19
21
  '331A92C3-5FE1-47A2-A31B-CFA439B5B4F9',
22
+ '331A92C3-5FE1-47A2-A31B-CFA439B5B4F9-fgf',
20
23
  '331A92C35FE147A2A31BCFA439B5B4F9',
21
24
  ]
22
25
  a.each { |s|
@@ -28,6 +31,13 @@ a.each { |s|
28
31
  puts ""
29
32
  puts "Filenames"
30
33
  a = [
34
+ 'c:\filename.txt',
35
+ 'c:/filename.txt',
36
+ 'filename_1.txt',
37
+ 'filename-1.txt',
38
+ 'filename+1.txt',
39
+ 'filename?1.txt',
40
+ 'filename*1.txt',
31
41
  'filename.txt',
32
42
  'filename',
33
43
  'filename.txt.rar',
data/lib/extend_string.rb CHANGED
@@ -1,49 +1,49 @@
1
1
  class String
2
2
  # returns true if the string meets all the security requirements for a password
3
3
  def password?
4
- return true if self.to_s =~ BlackStack::Strings::MATCH_PASSWORD
4
+ return true if self.to_s =~ /^#{BlackStack::Strings::MATCH_PASSWORD}$/
5
5
  return false
6
6
  end
7
7
 
8
8
  # returns true if the string match with the regex of a GUID
9
9
  def guid?
10
- return true if self.to_s =~ BlackStack::Strings::MATCH_GUID
10
+ return true if self.to_s =~ /^#{BlackStack::Strings::MATCH_GUID}$/
11
11
  return false
12
12
  end
13
13
 
14
14
  # returns true if the string match with the regex of a filename
15
15
  def filename?
16
- return true if self.to_s =~ BlackStack::Strings::MATCH_FILENAME
16
+ return true if self.to_s =~ /^#{BlackStack::Strings::MATCH_FILENAME}$/
17
17
  return false
18
18
  end
19
19
 
20
20
  # returns true if the string match with the regex of an email
21
21
  def email?
22
- return true if self.to_s =~ BlackStack::Strings::MATCH_EMAIL
22
+ return true if self.to_s =~ /^#{BlackStack::Strings::MATCH_EMAIL}$/
23
23
  return false
24
24
  end
25
25
 
26
26
  # returns true if the string match with the regex of a domain
27
27
  def domain?
28
- return true if self.to_s =~ BlackStack::Strings::MATCH_DOMAIN
28
+ return true if self.to_s =~ /^#{BlackStack::Strings::MATCH_DOMAIN}$/
29
29
  return false
30
30
  end
31
31
 
32
32
  # returns true if the string match with the regex of a phone number
33
33
  def phone?
34
- return true if self.to_s =~ BlackStack::Strings::MATCH_PHONE
34
+ return true if self.to_s =~ /^#{BlackStack::Strings::MATCH_PHONE}$/
35
35
  return false
36
36
  end
37
37
 
38
38
  # returns true if the string match with the regex of a URL
39
39
  def url?
40
- return true if self.to_s =~ BlackStack::Strings::MATCH_URL
40
+ return true if self.to_s =~ /^#{BlackStack::Strings::MATCH_URL}$/
41
41
  return false
42
42
  end
43
43
 
44
44
  # returns true if the string match with the regex of a number
45
45
  def fixnum?
46
- return true if self.to_s =~ BlackStack::Strings::MATCH_FIXNUM
46
+ return true if self.to_s =~ /^#{BlackStack::Strings::MATCH_FIXNUM}$/
47
47
  return false
48
48
  end
49
49
 
@@ -109,7 +109,3 @@ class String
109
109
  end
110
110
 
111
111
  end # class String
112
-
113
- #i.to_label
114
-
115
- #dt.to_sql
data/lib/functions.rb CHANGED
@@ -89,16 +89,16 @@ module BlackStack
89
89
  module Strings
90
90
 
91
91
  GUID_SIZE = 36
92
- MATCH_PASSWORD = /^(?=.*[a-zA-Z])(?=.*[0-9]).{6,}$/
93
- MATCH_GUID = /[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]/
94
- MATCH_FILENAME = /^[\w,\s-]+\.[A-Za-z]{3}$/
92
+ MATCH_PASSWORD = /(?=.*[a-zA-Z])(?=.*[0-9]).{6,}/
93
+ MATCH_GUID = /{?[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\-[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]}?/
94
+ MATCH_FILENAME = /[\w\-\_\.]+/
95
95
  MATCH_EMAIL = /[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}/
96
96
  MATCH_DOMAIN = /(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}/
97
- MATCH_DATE_STANDARD = /^\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])$/
97
+ MATCH_DATE_STANDARD = /\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])/
98
98
  MATCH_PHONE = /(?:\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}/
99
99
  MATCH_URL = /(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ # /(?:\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}/
100
100
  MATCH_LINKEDIN_COMPANY_URL = /(https?:\/\/)?(www\\.)?linkedin\.com\/company\//
101
- MATCH_FIXNUM = /^[0-9]+$/
101
+ MATCH_FIXNUM = /[0-9]+/
102
102
  MATCH_CONTENT_SPINNING = /{[^}]+}/
103
103
  MATCH_SPINNED_TEXT = /code me/ # TODO: define this regex for the issue #1226
104
104
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blackstack_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi