thanoscase 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: f792fa9959f2ff2fd2206df53e6b1492a2522b32e3ce67ac993d0ffe79e8da67
4
- data.tar.gz: 97fd0d27a0500f35ab4e5df34267261f610d6d411b25a938dab49f15055834cb
3
+ metadata.gz: b7645870ddf8dec162523f139ee3a9ed78d704b867b754c2cd7ad553e8a717ee
4
+ data.tar.gz: c8ea0f80fee9294e8eb19ed2d509f2b7cfa6a4a0489354a2826be3e962aed53f
5
5
  SHA512:
6
- metadata.gz: af128c4219dfc60d4d4d22f40aa7f758a02a9d3bd4bffecb9c605b8c87ea3faec7f9f6394a6cc61064fbf08756df19416f896b0ddba18e832204231fd27e42a0
7
- data.tar.gz: d4bf26356bc722f6cb72973b99ef38c93dc9831ecb43daff1a356d0d3114d5390bc52f220c456c20d2ad40e2c663228815c6592069168b2044cbe295336b3632
6
+ metadata.gz: 19c154b6357e27ef8b63b397931e23b4b029f9b6f01c5ee730890cadffdf051420324f57170bfb450c24c4798e162077f507aa1b4fbce556f0392f66a4d44fb4
7
+ data.tar.gz: d739f35cc27c1f186331ed5c24eb0bcc53efd425d03fa8371b73fb2511927e9de9dfc68873f978799df381073b4705b58bcfa013fbdcc7f32772fa165a35da39
@@ -0,0 +1,43 @@
1
+ version: 2.1
2
+ commands:
3
+ cached-bundle:
4
+ steps:
5
+ - restore_cache:
6
+ keys:
7
+ - gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
8
+ - gem-cache-v1-{{ arch }}-{{ .Branch }}
9
+ - gem-cache-v1
10
+ - run: bundle install --path vendor/bundle
11
+ - save_cache:
12
+ key: gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
13
+ paths:
14
+ - vendor/bundle
15
+ rspec-tests:
16
+ steps:
17
+ - run: |
18
+ bundle exec rspec \
19
+ --profile 10 \
20
+ --format progress \
21
+ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
22
+
23
+ executors:
24
+ ruby-2-6-2:
25
+ docker:
26
+ - image: circleci/ruby:2.6.2
27
+ environment:
28
+ BUNDLE_JOBS: 3
29
+ BUNDLE_RETRY: 3
30
+ BUNDLE_PATH: vendor/bundle
31
+ jobs:
32
+ build:
33
+ working_directory: ~/app
34
+ executor: ruby-2-6-2
35
+ steps:
36
+ - checkout
37
+ - cached-bundle
38
+ - rspec-tests
39
+
40
+ workflows:
41
+ main:
42
+ jobs:
43
+ - build
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,245 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
4
+ # to ignore them, so only the ones explicitly set in this file are enabled.
5
+ DisabledByDefault: true
6
+
7
+ Performance:
8
+ Exclude:
9
+ - '**/test/**/*'
10
+
11
+ Rails:
12
+ Enabled: true
13
+
14
+ # Prefer assert_not over assert !
15
+ Rails/AssertNot:
16
+ Include:
17
+ - '**/test/**/*'
18
+
19
+ # Prefer assert_not_x over refute_x
20
+ Rails/RefuteMethods:
21
+ Include:
22
+ - '**/test/**/*'
23
+
24
+ # Prefer &&/|| over and/or.
25
+ Style/AndOr:
26
+ Enabled: true
27
+
28
+ # Do not use braces for hash literals when they are the last argument of a
29
+ # method call.
30
+ Style/BracesAroundHashParameters:
31
+ Enabled: true
32
+ EnforcedStyle: context_dependent
33
+
34
+ # Align `when` with `case`.
35
+ Layout/CaseIndentation:
36
+ Enabled: true
37
+
38
+ # Align comments with method definitions.
39
+ Layout/CommentIndentation:
40
+ Enabled: true
41
+
42
+ Layout/ElseAlignment:
43
+ Enabled: true
44
+
45
+ # Align `end` with the matching keyword or starting expression except for
46
+ # assignments, where it should be aligned with the LHS.
47
+ Layout/EndAlignment:
48
+ Enabled: true
49
+ EnforcedStyleAlignWith: variable
50
+ AutoCorrect: true
51
+
52
+ Layout/EmptyLineAfterMagicComment:
53
+ Enabled: true
54
+
55
+ Layout/EmptyLinesAroundBlockBody:
56
+ Enabled: true
57
+
58
+ # In a regular class definition, no empty lines around the body.
59
+ Layout/EmptyLinesAroundClassBody:
60
+ Enabled: true
61
+
62
+ # In a regular method definition, no empty lines around the body.
63
+ Layout/EmptyLinesAroundMethodBody:
64
+ Enabled: true
65
+
66
+ # In a regular module definition, no empty lines around the body.
67
+ Layout/EmptyLinesAroundModuleBody:
68
+ Enabled: true
69
+
70
+ Layout/FirstParameterIndentation:
71
+ Enabled: true
72
+
73
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
74
+ Style/HashSyntax:
75
+ Enabled: true
76
+
77
+ # Method definitions after `private` or `protected` isolated calls need one
78
+ # extra level of indentation.
79
+ Layout/IndentationConsistency:
80
+ Enabled: true
81
+ EnforcedStyle: rails
82
+
83
+ # Two spaces, no tabs (for indentation).
84
+ Layout/IndentationWidth:
85
+ Enabled: true
86
+
87
+ Layout/LeadingCommentSpace:
88
+ Enabled: true
89
+
90
+ Layout/SpaceAfterColon:
91
+ Enabled: true
92
+
93
+ Layout/SpaceAfterComma:
94
+ Enabled: true
95
+
96
+ Layout/SpaceAfterSemicolon:
97
+ Enabled: true
98
+
99
+ Layout/SpaceAroundEqualsInParameterDefault:
100
+ Enabled: true
101
+
102
+ Layout/SpaceAroundKeyword:
103
+ Enabled: true
104
+
105
+ Layout/SpaceAroundOperators:
106
+ Enabled: true
107
+
108
+ Layout/SpaceBeforeComma:
109
+ Enabled: true
110
+
111
+ Layout/SpaceBeforeComment:
112
+ Enabled: true
113
+
114
+ Layout/SpaceBeforeFirstArg:
115
+ Enabled: true
116
+
117
+ Style/DefWithParentheses:
118
+ Enabled: true
119
+
120
+ # Defining a method with parameters needs parentheses.
121
+ Style/MethodDefParentheses:
122
+ Enabled: true
123
+
124
+ Style/FrozenStringLiteralComment:
125
+ Enabled: true
126
+ EnforcedStyle: always
127
+ Exclude:
128
+ - 'actionview/test/**/*.builder'
129
+ - 'actionview/test/**/*.ruby'
130
+ - 'actionpack/test/**/*.builder'
131
+ - 'actionpack/test/**/*.ruby'
132
+ - 'activestorage/db/migrate/**/*.rb'
133
+ - 'activestorage/db/update_migrate/**/*.rb'
134
+ - 'actionmailbox/db/migrate/**/*.rb'
135
+ - 'actiontext/db/migrate/**/*.rb'
136
+
137
+ Style/RedundantFreeze:
138
+ Enabled: true
139
+
140
+ # Use `foo {}` not `foo{}`.
141
+ Layout/SpaceBeforeBlockBraces:
142
+ Enabled: true
143
+
144
+ # Use `foo { bar }` not `foo {bar}`.
145
+ Layout/SpaceInsideBlockBraces:
146
+ Enabled: true
147
+ EnforcedStyleForEmptyBraces: space
148
+
149
+ # Use `{ a: 1 }` not `{a:1}`.
150
+ Layout/SpaceInsideHashLiteralBraces:
151
+ Enabled: true
152
+
153
+ Layout/SpaceInsideParens:
154
+ Enabled: true
155
+
156
+ # Check quotes usage according to lint rule below.
157
+ Style/StringLiterals:
158
+ Enabled: true
159
+ EnforcedStyle: double_quotes
160
+
161
+ # Detect hard tabs, no hard tabs.
162
+ Layout/Tab:
163
+ Enabled: true
164
+
165
+ # Blank lines should not have any spaces.
166
+ Layout/TrailingBlankLines:
167
+ Enabled: true
168
+
169
+ # No trailing whitespace.
170
+ Layout/TrailingWhitespace:
171
+ Enabled: true
172
+
173
+ # Use quotes for string literals when they are enough.
174
+ Style/UnneededPercentQ:
175
+ Enabled: true
176
+
177
+ Lint/AmbiguousOperator:
178
+ Enabled: true
179
+
180
+ Lint/AmbiguousRegexpLiteral:
181
+ Enabled: true
182
+
183
+ Lint/ErbNewArguments:
184
+ Enabled: true
185
+
186
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
187
+ Lint/RequireParentheses:
188
+ Enabled: true
189
+
190
+ Lint/ShadowingOuterLocalVariable:
191
+ Enabled: true
192
+
193
+ Lint/StringConversionInInterpolation:
194
+ Enabled: true
195
+
196
+ Lint/UriEscapeUnescape:
197
+ Enabled: true
198
+
199
+ Lint/UselessAssignment:
200
+ Enabled: true
201
+
202
+ Lint/DeprecatedClassMethods:
203
+ Enabled: true
204
+
205
+ Style/ParenthesesAroundCondition:
206
+ Enabled: true
207
+
208
+ Style/RedundantBegin:
209
+ Enabled: true
210
+
211
+ Style/RedundantReturn:
212
+ Enabled: true
213
+ AllowMultipleReturnValues: true
214
+
215
+ Style/Semicolon:
216
+ Enabled: true
217
+ AllowAsExpressionSeparator: true
218
+
219
+ # Prefer Foo.method over Foo::method
220
+ Style/ColonMethodCall:
221
+ Enabled: true
222
+
223
+ Style/TrivialAccessors:
224
+ Enabled: true
225
+
226
+ Performance/FlatMap:
227
+ Enabled: true
228
+
229
+ Performance/RedundantMerge:
230
+ Enabled: true
231
+
232
+ Performance/StartWith:
233
+ Enabled: true
234
+
235
+ Performance/EndWith:
236
+ Enabled: true
237
+
238
+ Performance/RegexpMatch:
239
+ Enabled: true
240
+
241
+ Performance/ReverseEach:
242
+ Enabled: true
243
+
244
+ Performance/UnfreezeString:
245
+ Enabled: true
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at nicolas.s.vidal@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,32 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ thanoscase (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rspec (3.8.0)
11
+ rspec-core (~> 3.8.0)
12
+ rspec-expectations (~> 3.8.0)
13
+ rspec-mocks (~> 3.8.0)
14
+ rspec-core (3.8.0)
15
+ rspec-support (~> 3.8.0)
16
+ rspec-expectations (3.8.2)
17
+ diff-lcs (>= 1.2.0, < 2.0)
18
+ rspec-support (~> 3.8.0)
19
+ rspec-mocks (3.8.0)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-support (3.8.0)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ rspec (~> 3.8)
29
+ thanoscase!
30
+
31
+ BUNDLED WITH
32
+ 1.17.3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Nicolas Sebastian Vidal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # Thanoscase
2
+
3
+ Wipes out your strings from the universe
4
+
5
+ # Installation
6
+
7
+ In your gemfile:
8
+
9
+ ```ruby
10
+ gem 'thanoscase', '~> 0.0.1'
11
+ ```
12
+
13
+ or in the console:
14
+
15
+ ```ruby
16
+ gem install thanoscase
17
+ ```
18
+
19
+ # Usage
20
+
21
+ This gem MonkeyPatches the String class for adding two new methods:
22
+
23
+ ```ruby
24
+ class String
25
+ def thanoscase!
26
+ return self if empty?
27
+ half_universe = length/2
28
+ half_universe.times { slice!(rand(length)) }
29
+ self
30
+ end
31
+
32
+ def thanoscase
33
+ dup.thanoscase!
34
+ end
35
+ end
36
+ ```
37
+
38
+ It will randomly eliminate half the characters you have in the string:
39
+
40
+ ```ruby
41
+ "Marvel Universe".thanoscase # "arel Uve"
42
+ "Marvel Universe".thanoscase # "rvlUners"
43
+ "Marvel Universe".thanoscase # "Marel ie"
44
+ ```
45
+
46
+ - If the amount of characters is even you will get half of them as return.
47
+ ```ruby
48
+ "1234".thanoscase # "14"
49
+ "1234".thanoscase # "12"
50
+ "1234".thanoscase # "34"
51
+ ```
52
+ - If the amount of characters is odd you will get half of them plus one.
53
+ ```ruby
54
+ "123".thanoscase # "23"
55
+ "123".thanoscase # "12"
56
+ "123".thanoscase # "13"
57
+ ```
58
+ - If you try to apply this method to an empty string, it will return the same empty string.
59
+ ```ruby
60
+ "".thanoscase # ""
61
+ ```
62
+
63
+ You can also modify the object it`self` like so:
64
+
65
+ ```ruby
66
+ str = "Avengers"
67
+ # "Avengers"
68
+ str.thanoscase
69
+ # "Aves"
70
+ str
71
+ # "Avengers"
72
+ str.thanoscase!
73
+ # "vegr"
74
+ str
75
+ # "vegr"
76
+ ```
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class String
2
4
  def thanoscase!
3
5
  return self if empty?
4
6
  half_universe = length/2
5
- half_universe.times { slice!(rand(length))}
7
+ half_universe.times { slice!(rand(length)) }
6
8
  self
7
9
  end
8
10
 
data/lib/thanoscase.rb CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "thanoscase/string"
data/thanoscase.gemspec CHANGED
@@ -1,18 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gem::Specification.new do |s|
2
- s.name = 'thanoscase'
3
- s.version = '0.0.1'
4
- s.date = '2019-04-27'
5
- s.summary = 'Thanos gem'
6
- s.description = 'A simple way to wipe out half the universe'
7
- s.authors = ['Nicolas Sebastian Vidal']
8
- s.email = 'nicolas.s.vidal@gmail.com'
9
- s.homepage = ''
4
+ s.name = "thanoscase"
5
+ s.version = "0.0.2"
6
+ s.date = "2019-04-27"
7
+ s.summary = "Thanos gem"
8
+ s.description = "Randomly removes half the characters of a given string."
9
+ s.authors = ["Nicolas Sebastian Vidal"]
10
+ s.email = "nicolas.s.vidal@gmail.com"
11
+ s.homepage = "https://github.com/nisevi/thanoscase"
12
+ s.bindir = "bin"
13
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ s.require_paths = ["lib"]
15
+ s.license = "MIT"
10
16
  s.files = `git ls-files -z`.split("\x0").reject do |f|
11
17
  f.match(%r{^(test|spec|features)/})
12
18
  end
13
- s.bindir = 'bin'
14
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
- s.require_paths = ['lib']
16
- s.required_ruby_version = '>= 2.5.0'
17
- s.license = 'MIT'
19
+ s.required_ruby_version = ">= 2.5.0"
20
+ s.add_development_dependency "rspec", "~> 3.8"
18
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thanoscase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Sebastian Vidal
@@ -9,17 +9,39 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-04-27 00:00:00.000000000 Z
12
- dependencies: []
13
- description: A simple way to wipe out half the universe
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.8'
27
+ description: Randomly removes half the characters of a given string.
14
28
  email: nicolas.s.vidal@gmail.com
15
29
  executables: []
16
30
  extensions: []
17
31
  extra_rdoc_files: []
18
32
  files:
33
+ - ".circleci/config.yml"
34
+ - ".rspec"
35
+ - ".rubocop.yml"
36
+ - CODE_OF_CONDUCT.md
37
+ - Gemfile
38
+ - Gemfile.lock
39
+ - LICENSE
40
+ - README.md
19
41
  - lib/thanoscase.rb
20
42
  - lib/thanoscase/string.rb
21
43
  - thanoscase.gemspec
22
- homepage: ''
44
+ homepage: https://github.com/nisevi/thanoscase
23
45
  licenses:
24
46
  - MIT
25
47
  metadata: {}
@@ -38,8 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
60
  - !ruby/object:Gem::Version
39
61
  version: '0'
40
62
  requirements: []
41
- rubyforge_project:
42
- rubygems_version: 2.7.3
63
+ rubygems_version: 3.0.3
43
64
  signing_key:
44
65
  specification_version: 4
45
66
  summary: Thanos gem