new_string 3.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/new_string.rb +22 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9e7f7d1e3cd04b30d75822722f82c1f2f3f96c900b40a1db250091f4e86e1cc8
4
+ data.tar.gz: e5975cb55eec3d2274f17e0a3178c6710e777f3eea4c6070c78a10c66542dd79
5
+ SHA512:
6
+ metadata.gz: 0b5227d13de987b62498dc8dd501561bda8b541cfa201120a9d45901e98832481004ff912ba0ea3bb85397efbdb9957fb33dc84e189ad0aa5b2b37b9bc5df50f
7
+ data.tar.gz: 811626efff493fc37a9a24772ccddc2e0d3227f9b6b0ab7942036e940333d35a883b2397c5500672149e363658975d046c521792673177897f04a704b4e6316b
data/lib/new_string.rb ADDED
@@ -0,0 +1,22 @@
1
+ class String
2
+ def valid_brackets?
3
+ stack = []
4
+ self.split('').each do |char|
5
+ if char == '('
6
+ stack << char
7
+ elsif char == ')'
8
+ if stack.pop != '('
9
+ return false
10
+ end
11
+ end
12
+ end
13
+ stack.empty?
14
+ end
15
+
16
+ def palindrome?
17
+ string = self
18
+ string.gsub!(/[^A-Za-z0-9]/, "")
19
+ string.downcase!
20
+ string == string.reverse
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: new_string
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Pavel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple hello world gem
14
+ email: kovylnikovpavel@mail.ru
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/new_string.rb
20
+ homepage: https://rubygems.org/gems/new_string
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.0.6
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Add new methods
43
+ test_files: []