mask_man 0.1.0 → 0.2.0
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/README.md +6 -5
- data/lib/mask_man/convert.rb +18 -2
- data/lib/mask_man/validate.rb +2 -2
- data/lib/mask_man/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 999b7d2f7512e5977c51da3c12646519aeedc46e
|
|
4
|
+
data.tar.gz: c403008b3d607f07057867d407246fee492e3461
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cfd31cf66364f1adaac2b5724df6978930621302ff8861297e91aec6688936153ca71bdce982d7d1982554002a96dd1bcda66de8c9ee8d9dbc13a366eeb7271
|
|
7
|
+
data.tar.gz: f0dfa2ebeec06905deb683e552ab59fe181d46f7809496dec29567f5ac848545f9b591e14a755fe0d3a426cda6088c81fe8ce129f743e2b8a99cfaa62a0c1be5
|
data/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
# MaskMan
|
|
1
|
+
# MaskMan
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/iFalcao/mask_man)
|
|
2
4
|
|
|
3
5
|
> Abstraction of the most common regular expressions (Regex) for your Ruby application. Validate and convert your strings fast and easy with Maskman. See **Usage** for more instructions and examples.
|
|
4
6
|
|
|
@@ -27,7 +29,7 @@ If you want to remove all special characters from your string, that's fairly sim
|
|
|
27
29
|
```ruby
|
|
28
30
|
require MaskMan
|
|
29
31
|
|
|
30
|
-
MaskMan::Convert.rm_special(
|
|
32
|
+
MaskMan::Convert.rm_special '(71) 3325-2564' # => '7133252564'
|
|
31
33
|
```
|
|
32
34
|
|
|
33
35
|
But in case you want to check the presence of a special character within your string, you can use:
|
|
@@ -35,7 +37,8 @@ But in case you want to check the presence of a special character within your st
|
|
|
35
37
|
```ruby
|
|
36
38
|
require MaskMan
|
|
37
39
|
|
|
38
|
-
MaskMan::Validate.has_special_chars?(
|
|
40
|
+
MaskMan::Validate.has_special_chars? '(71) 3325-2564' # => true
|
|
41
|
+
MaskMan::Validate.has_special_chars? '7133252564' # => false
|
|
39
42
|
```
|
|
40
43
|
|
|
41
44
|
## Development
|
|
@@ -44,8 +47,6 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
|
44
47
|
|
|
45
48
|
Be sure to create the test cases for your new feature, we are using [RSpec](https://github.com/rspec/rspec-rails) to accomplish this.
|
|
46
49
|
|
|
47
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
48
|
-
|
|
49
50
|
## Contributing
|
|
50
51
|
|
|
51
52
|
Bug reports and pull requests are welcome on GitHub at https://github.com/iFalcao/mask_man.
|
data/lib/mask_man/convert.rb
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
module MaskMan
|
|
2
2
|
class Convert
|
|
3
|
-
def self.rm_special
|
|
4
|
-
return string.gsub(/[^0-9A-Za-z]/, '')
|
|
3
|
+
def self.rm_special string
|
|
4
|
+
return string == nil ? '' : string.gsub(/[^0-9A-Za-z]/, '')
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.rm_letters string
|
|
8
|
+
return string == nil ? '' : string.gsub(/[A-Za-z]/, '')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.rm_numbers string
|
|
12
|
+
return string == nil ? '' : string.gsub(/[0-9]/, '')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.only_letters string
|
|
16
|
+
return string == nil ? '' : string.gsub(/[^A-Za-z]/, '')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.only_numbers string
|
|
20
|
+
return string == nil ? '' : string.gsub(/[^0-9]/, '')
|
|
5
21
|
end
|
|
6
22
|
end
|
|
7
23
|
end
|
data/lib/mask_man/validate.rb
CHANGED
data/lib/mask_man/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mask_man
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Icaro Falcao
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|