ndl_string 0.0.1
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 +7 -0
- data/lib/ndl_string.rb +27 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 39e12bbf3ab8882c2fd6a417691bab25068cf34519012dfc2beb31a52b19794a
|
4
|
+
data.tar.gz: a8d8af57ac8ef388f4fa2f85818bb58d2de86a1f5662f0484c02869c81819f10
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c74758b7a81ea6c7959b8ea055ea5594ce058de385ed41a68296457b2d6dfd58ab293d7d5c668c2ecb24e8d62bce1518397a9417b1962f54fe43be129fdf4178
|
7
|
+
data.tar.gz: ca757c5b987fe8d8d250f199e66af0badd89f2a84e3ff93e0796cf463bc92026597780e44ef5e83f0cd79a74b91a3965001c0f7e88c6e3adb70551d36d090169
|
data/lib/ndl_string.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# My extended string class
|
2
|
+
class String
|
3
|
+
|
4
|
+
# Checking the correct sequence of brackets in a string!
|
5
|
+
def valid_brackets?
|
6
|
+
counter = 0
|
7
|
+
|
8
|
+
each_char do |char|
|
9
|
+
if char == '('
|
10
|
+
counter += 1
|
11
|
+
elsif char == ')'
|
12
|
+
counter -= 1
|
13
|
+
end
|
14
|
+
|
15
|
+
return false if counter.negative?
|
16
|
+
end
|
17
|
+
|
18
|
+
counter.zero?
|
19
|
+
end
|
20
|
+
|
21
|
+
# Checking a string on a palindrome
|
22
|
+
def palindrome?
|
23
|
+
true_string = downcase.scan(/\w/)
|
24
|
+
true_string == true_string.reverse
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ndl_string
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: My monkey patching ruby string for improving my skills of Ruby and Rubygems
|
14
|
+
email: 62559350+Nadelow@users.noreply.github.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/ndl_string.rb
|
20
|
+
homepage: https://github.com/Nadelow/ndl_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.1.2
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: My monkey patching string!
|
43
|
+
test_files: []
|