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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1681b9c87b78ad8dcfe09da091a6f4ce279bf75b
4
- data.tar.gz: d6436d6a30a764deef51840ef668e74ef00788c5
3
+ metadata.gz: 999b7d2f7512e5977c51da3c12646519aeedc46e
4
+ data.tar.gz: c403008b3d607f07057867d407246fee492e3461
5
5
  SHA512:
6
- metadata.gz: c07b179ce8851e2270ead42bcbcc089b62b367d4eaf70f14285f1447862363f55440fb59f721a6c48bc93309ac90836df106a08ed1a172aa9b3649db4efdb818
7
- data.tar.gz: f952d0b360b8d9a044174b8e98feba5e15df042f95f810c6ee3d737fa6e701c9c08fe2d700439bdc9a9a1a5d9f13e32d31eb214ddba496647475fc6ebe2df88f
6
+ metadata.gz: 1cfd31cf66364f1adaac2b5724df6978930621302ff8861297e91aec6688936153ca71bdce982d7d1982554002a96dd1bcda66de8c9ee8d9dbc13a366eeb7271
7
+ data.tar.gz: f0dfa2ebeec06905deb683e552ab59fe181d46f7809496dec29567f5ac848545f9b591e14a755fe0d3a426cda6088c81fe8ce129f743e2b8a99cfaa62a0c1be5
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # MaskMan
1
+ # MaskMan
2
+
3
+ [![Build Status](https://travis-ci.org/iFalcao/mask_man.svg?branch=master)](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(your_string_here)
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?(your_string_here)
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.
@@ -1,7 +1,23 @@
1
1
  module MaskMan
2
2
  class Convert
3
- def self.rm_special(string)
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
@@ -13,7 +13,7 @@ module MaskMan
13
13
  end
14
14
  end
15
15
 
16
- contains
16
+ return contains
17
17
  end
18
18
 
19
19
  def self.only_asc?(string)
@@ -26,7 +26,7 @@ module MaskMan
26
26
  end
27
27
  end
28
28
 
29
- only_asc
29
+ return only_asc
30
30
  end
31
31
 
32
32
  def self.count_special_chars(string)
@@ -1,3 +1,3 @@
1
1
  module MaskMan
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-23 00:00:00.000000000 Z
11
+ date: 2017-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler