zandelok_custom_functions 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/array/count_array.rb +7 -0
- data/lib/array/increase_array.rb +11 -0
- data/lib/array/select_array.rb +7 -0
- data/lib/array/split_array.rb +7 -0
- data/lib/errors/data_error.rb +9 -0
- data/lib/errors/errors.rb +4 -0
- data/lib/errors/type_error.rb +9 -0
- data/lib/helpers/hashtag_helper.rb +16 -0
- data/lib/string/camelcase_string.rb +8 -0
- data/lib/string/count_string.rb +7 -0
- data/lib/string/palindrome_string.rb +7 -0
- data/lib/zandelok/functions.rb +34 -0
- data/lib/zandelok_custom_functions.rb +10 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 20cb3c00132a3ea4dc03d2df68e14121bd0e55f2e872fcba81f6c6780bfb1f18
|
4
|
+
data.tar.gz: d881986482ac68201d2809343e9d9fe77ef2d0efc635911c2921ddd2558195b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ce89e5a2ef2a9171e105e54a344734c916262600ba19c1be5251c5a086bfa830e3c6e33944a66e72770b55b28296eff65ec523fe3f9a121796fd79362fe6dc9f
|
7
|
+
data.tar.gz: 3286f5476c841014bae10eafa1110a0f7bcedfeaedfd7f648aa1c0de52fe3e68c7e606c7a769fe003c04a5ef938d9ca0b54e2aafde107a9683a4dd0c5987716d
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../errors/errors'
|
4
|
+
|
5
|
+
module Helpers
|
6
|
+
class HashtagHelper
|
7
|
+
def self.make_hashtag(array)
|
8
|
+
raise Errors::DataError, 'Hashtag should consist of one or more symbols' if array.empty?
|
9
|
+
|
10
|
+
hashtag = "##{array.map(&:to_s).map(&:capitalize).join}"
|
11
|
+
raise Errors::DataError, 'Hashtag max length 140 symbols' if hashtag.length > 140
|
12
|
+
|
13
|
+
hashtag
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../errors/errors'
|
4
|
+
require_relative '../helpers/hashtag_helper'
|
5
|
+
|
6
|
+
module Zandelok
|
7
|
+
class Functions
|
8
|
+
def self.multiply(*args)
|
9
|
+
raise Errors::TypeError, 'Method accept only integers' unless args.all?(Integer)
|
10
|
+
raise Errors::DataError, 'Method should accept two or more values' unless args.size >= 2
|
11
|
+
|
12
|
+
args.reduce(:*)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.missing_numbers(numbers)
|
16
|
+
raise Errors::TypeError, 'Method accept only array' unless numbers.is_a?(Array)
|
17
|
+
raise Errors::TypeError, 'Array should consist of integers only' unless numbers.all?(Integer)
|
18
|
+
raise Errors::DataError, 'Array should consist of two or more variables' unless numbers.size >= 2
|
19
|
+
|
20
|
+
[*numbers.min..numbers.max] - numbers
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.generate_hashtag(input)
|
24
|
+
case input
|
25
|
+
when Array
|
26
|
+
Helpers::HashtagHelper.make_hashtag(input)
|
27
|
+
when String
|
28
|
+
Helpers::HashtagHelper.make_hashtag(input.split)
|
29
|
+
else
|
30
|
+
raise Errors::TypeError, 'Method accept only array or string'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'array/count_array'
|
4
|
+
require_relative 'array/increase_array'
|
5
|
+
require_relative 'array/select_array'
|
6
|
+
require_relative 'array/split_array'
|
7
|
+
require_relative 'string/camelcase_string'
|
8
|
+
require_relative 'string/count_string'
|
9
|
+
require_relative 'string/palindrome_string'
|
10
|
+
require_relative 'zandelok/functions'
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zandelok_custom_functions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kirill Gleb
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: gleb.kirill98@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/array/count_array.rb
|
20
|
+
- lib/array/increase_array.rb
|
21
|
+
- lib/array/select_array.rb
|
22
|
+
- lib/array/split_array.rb
|
23
|
+
- lib/errors/data_error.rb
|
24
|
+
- lib/errors/errors.rb
|
25
|
+
- lib/errors/type_error.rb
|
26
|
+
- lib/helpers/hashtag_helper.rb
|
27
|
+
- lib/string/camelcase_string.rb
|
28
|
+
- lib/string/count_string.rb
|
29
|
+
- lib/string/palindrome_string.rb
|
30
|
+
- lib/zandelok/functions.rb
|
31
|
+
- lib/zandelok_custom_functions.rb
|
32
|
+
homepage: https://github.com/Zandelok/zandelok_custom_functions
|
33
|
+
licenses: []
|
34
|
+
metadata:
|
35
|
+
rubygems_mfa_required: 'false'
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.6.0
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubygems_version: 3.3.3
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: This gem will help you extend the functionality of some standard Ruby classes.
|
55
|
+
It also provides some custom methods.
|
56
|
+
test_files: []
|