demo_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: 869333f6fb9f129a5126cf8d114311fc08f2033002ab1f870243a9f43abf3f32
4
- data.tar.gz: 280675f1ab04b3254bf0433bac4297a92a8f9c56bddff016954f9f4c67bca3fa
3
+ metadata.gz: 872e4de93d65435efc7f6b369d193f549ed8ac9682b5c2122cdaccbf2df615e5
4
+ data.tar.gz: db0ec2edaea31848c5c6e819e85e68cc6d743dec8783aa0c6e4882b708204dbb
5
5
  SHA512:
6
- metadata.gz: f6f910f79b26689487a17a47278c2475decd4372a1cfa5efb3dad0f659cc7806738d2a7f38d5e0cceca50bc058ec68863f0a8bfdf0082746989ca92b5653dec0
7
- data.tar.gz: 2cb283ead4cccb2c44921babd7479391690a05f01bf734356840220d7e6989e3b361dadf74c4b37d753310b305f51383fb623746058c1277181ad74fb66d3bd8
6
+ metadata.gz: 0cb7c52bd9743df48591671fe2a53628784f7fe7588dd6a6566471dbd9c9ee2ecb1a9c11122778087d28dc5e594ec37f503d419bdc695bd8122a9b964402d31b
7
+ data.tar.gz: b6533174ca067523df91618e2a135ab3f11156e6a2b2af0fe346b5396074e5e551d2f83131caf3841e394080958e6ee76ac76a57bc082276da6c3c5a17f45ab1
@@ -0,0 +1,47 @@
1
+ version: 2.1
2
+ commands:
3
+ cached-bundle:
4
+ steps:
5
+ # Restore bundle cache
6
+ - restore_cache:
7
+ keys:
8
+ - rails-bundle-{{ checksum "Gemfile.lock" }}
9
+ - rails-bundle-
10
+ - run:
11
+ name: Bundle Install
12
+ command: bundle check || bundle install
13
+ # Store bundle cache
14
+ - save_cache:
15
+ key: rails-bundle-{{ checksum "Gemfile.lock" }}
16
+ paths:
17
+ - vendor/bundle
18
+ rspec-tests:
19
+ steps:
20
+ # Run rspec in parallel
21
+ - run: |
22
+ bundle exec rspec \
23
+ --profile 10 \
24
+ --format progress \
25
+ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
26
+
27
+ executors:
28
+ ruby260-pg969:
29
+ docker:
30
+ - image: circleci/ruby:2.6.2
31
+ environment:
32
+ BUNDLE_JOBS: 3
33
+ BUNDLE_RETRY: 3
34
+ BUNDLE_PATH: vendor/bundle
35
+ jobs:
36
+ build:
37
+ working_directory: ~/app
38
+ executor: ruby260-pg969
39
+ steps:
40
+ - checkout
41
+ - cached-bundle
42
+ - rspec-tests
43
+
44
+ workflows:
45
+ main:
46
+ jobs:
47
+ - build
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -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,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
@@ -0,0 +1,32 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ demo_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
+ demo_thanoscase!
29
+ rspec (~> 3.8)
30
+
31
+ BUNDLED WITH
32
+ 1.17.3
data/README.md CHANGED
@@ -1,2 +1,76 @@
1
- # demo_thanoscase
1
+ # Demo Thanoscase
2
+
2
3
  Wipes out your strings from the universe
4
+
5
+ # Installation
6
+
7
+ In your gemfile:
8
+
9
+ ```ruby
10
+ gem 'demo_thanoscase', '~> 0.0.1'
11
+ ```
12
+
13
+ or in the console:
14
+
15
+ ```ruby
16
+ gem install demo_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,19 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Gem::Specification.new do |s|
2
- s.name = 'demo_thanoscase'
3
- s.version = '0.0.1'
4
- s.date = '2019-04-26'
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 = 'http://rubygems.org/gems/demo_thanoscase'
4
+ s.name = "demo_thanoscase"
5
+ s.version = "0.0.2"
6
+ s.date = "2019-04-26"
7
+ s.summary = "Thanos gem"
8
+ s.description = "A simple way to wipe out half the universe"
9
+ s.authors = ["Nicolas Sebastian Vidal"]
10
+ s.email = "nicolas.s.vidal@gmail.com"
11
+ s.homepage = "http://rubygems.org/gems/demo_thanoscase"
12
+ s.require_paths = ["lib"]
13
+ s.license = "MIT"
10
14
  s.files = `git ls-files -z`.split("\x0").reject do |f|
11
15
  f.match(%r{^(test|spec|features)/})
12
16
  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
-
18
- s.license = 'MIT'
17
+ s.required_ruby_version = ">= 2.5.0"
18
+ s.add_development_dependency "rspec", "~> 3.8"
19
19
  end
@@ -1 +1,3 @@
1
- require 'demo_thanoscase/string'
1
+ # frozen_string_literal: true
2
+
3
+ require "demo_thanoscase/string"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class String
2
4
  def thanoscase!
3
5
  return self if empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demo_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,14 +9,34 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-04-26 00:00:00.000000000 Z
12
- dependencies: []
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'
13
27
  description: A simple way to wipe out half the universe
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"
19
34
  - ".gitignore"
35
+ - ".rspec"
36
+ - ".rubocop.yml"
37
+ - CODE_OF_CONDUCT.md
38
+ - Gemfile
39
+ - Gemfile.lock
20
40
  - LICENSE
21
41
  - README.md
22
42
  - demo_thanoscase.gemspec