susan_collins 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 721f97c55f2a959e4ac24cc3c3957d5f289118d54773e76f34a8951a3d66735f
4
- data.tar.gz: 2685d933b0078239e04857a0f258f81176a4ceefec4a592b570cbb1fb91b5d8e
3
+ metadata.gz: 7f1068dea712c9ee63179a116548ed6c824d6d741dbdf52844798398b02e30de
4
+ data.tar.gz: f5691387dff394d02a52641be9319cc2e0a079b7ad30441ec554b186174f1815
5
5
  SHA512:
6
- metadata.gz: 73c5ef7dfe162d88277f82e145a9842eded622c0b02bffef10193c922f8fe265dfe0973c23b2c3c0903af6ba4861b654b276f85495144b2572f78c449a74c915
7
- data.tar.gz: 4aa4efcec496e0552fa551a884253cf799045ad810f1c7d6fa04d9a049cc5eeb993e76c18b0132304049b5e56543703cc88617d9a30360380209e0fa048fcf08
6
+ metadata.gz: db948e1396a09f677adb6f4de292319d699b6c718a7a915ca45ae464ba825365ce06cc22408a13b877a69bea25cc77f3af40aa66340d6ba06c793b76750f9eea
7
+ data.tar.gz: 5d2ace5683959eebe542e71a276abfe48c85c99eca064718969b0ac4183f3506df1e9784f8d7d1d0d55b11078ca2cf0cd39e244f14c040927fc11569255f9c54
data/Gemfile CHANGED
@@ -5,3 +5,5 @@ gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
+
9
+ gem "pry", "~> 0.13.1"
@@ -1,12 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- susan_collins (0.1.0)
4
+ susan_collins (0.2.0)
5
+ activesupport
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
10
+ activesupport (6.1.0)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ coderay (1.1.3)
17
+ concurrent-ruby (1.1.7)
9
18
  diff-lcs (1.4.4)
19
+ i18n (1.8.5)
20
+ concurrent-ruby (~> 1.0)
21
+ method_source (1.0.0)
22
+ minitest (5.14.2)
23
+ pry (0.13.1)
24
+ coderay (~> 1.1)
25
+ method_source (~> 1.0)
10
26
  rake (12.3.3)
11
27
  rspec (3.10.0)
12
28
  rspec-core (~> 3.10.0)
@@ -21,11 +37,15 @@ GEM
21
37
  diff-lcs (>= 1.2.0, < 2.0)
22
38
  rspec-support (~> 3.10.0)
23
39
  rspec-support (3.10.0)
40
+ tzinfo (2.0.4)
41
+ concurrent-ruby (~> 1.0)
42
+ zeitwerk (2.4.2)
24
43
 
25
44
  PLATFORMS
26
45
  ruby
27
46
 
28
47
  DEPENDENCIES
48
+ pry (~> 0.13.1)
29
49
  rake (~> 12.0)
30
50
  rspec (~> 3.0)
31
51
  susan_collins!
@@ -1,21 +1,24 @@
1
- The MIT License (MIT)
1
+ This is free and unencumbered software released into the public domain.
2
2
 
3
- Copyright (c) 2020 Jonathan Allard
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
4
7
 
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:
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
11
15
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
14
23
 
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
21
- THE SOFTWARE.
24
+ For more information, please refer to <https://unlicense.org>
data/README.md CHANGED
@@ -1,8 +1,64 @@
1
- # SusanCollins
1
+ # susan_collins
2
+ Use `Concern` everywhere
2
3
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/susan_collins`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+ Sets the global `Concern` to [`ActiveSupport::Concern`][ASC] so you don't have to type those pesky extra characters.
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ [ASC]: https://api.rubyonrails.org/classes/ActiveSupport/Concern.html
7
+
8
+ ## Usage
9
+ In either your Gemfile or code, require the main module:
10
+
11
+ ```ruby
12
+ # Gemfile
13
+ gem "susan_collins"
14
+
15
+ # or
16
+ require "susan_collins"
17
+ ```
18
+
19
+ You can now:
20
+
21
+ ```ruby
22
+ module DeepConcern
23
+ extend Concern
24
+
25
+ class_methods do
26
+ # ...
27
+ end
28
+
29
+ included do
30
+ # ...
31
+ end
32
+
33
+ # ...
34
+ end
35
+ ```
36
+
37
+ With the regular require, you get [`concerning`][MC] too:
38
+
39
+ ```ruby
40
+ class TremendouslyLargeClass
41
+ # ...
42
+ include DeepConcern
43
+
44
+ concerning :SeriousConcerns do
45
+ # ...
46
+ end
47
+ end
48
+ ```
49
+
50
+ [MC]: https://api.rubyonrails.org/classes/Module/Concerning.html
51
+
52
+ ### Just Concern
53
+ If you don't want `Module#concerning`:
54
+
55
+ ```ruby
56
+ # Gemfile
57
+ gem "susan_collins", require: "susan_collins/deep_concern"
58
+
59
+ # or
60
+ require "susan_collins/deep_concern"
61
+ ```
6
62
 
7
63
  ## Installation
8
64
 
@@ -20,10 +76,6 @@ Or install it yourself as:
20
76
 
21
77
  $ gem install susan_collins
22
78
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
79
  ## Development
28
80
 
29
81
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -35,10 +87,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
35
87
  Bug reports and pull requests are welcome on GitHub at https://github.com/joallard/susan_collins. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/joallard/susan_collins/blob/master/CODE_OF_CONDUCT.md).
36
88
 
37
89
 
38
- ## License
39
-
40
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
-
42
90
  ## Code of Conduct
43
91
 
44
92
  Everyone interacting in the SusanCollins project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/joallard/susan_collins/blob/master/CODE_OF_CONDUCT.md).
@@ -1,6 +1,30 @@
1
+ require "susan_collins/deep_concern"
1
2
  require "susan_collins/version"
2
3
 
3
4
  module SusanCollins
5
+ extend self
6
+
7
+ def self.is_concerned!
8
+ is_deeply_concerned!; is_very_concerned!
9
+ end
10
+
11
+ def self.is_concerned?
12
+ is_deeply_concerned? && is_very_concerned?
13
+ end
14
+
15
+ def self.is_very_concerned!
16
+ require "susan_collins/very_concerning"
17
+ end
18
+
19
+ def self.is_very_concerned?
20
+ Module.method_defined?(:concerning)
21
+ end
22
+
23
+ def self.concerned?; is_concerned?; end
24
+ def self.very_concerned?; is_very_concerned?; end
25
+ def self.deeply_concerned?; is_deeply_concerned?; end
26
+
4
27
  class Error < StandardError; end
5
- # Your code goes here...
6
28
  end
29
+
30
+ SusanCollins.is_concerned!
@@ -0,0 +1,19 @@
1
+ require "active_support/concern"
2
+
3
+ module SusanCollins
4
+ module DeepConcern
5
+ extend ActiveSupport::Concern # sad!
6
+
7
+ class_methods do
8
+ def is_deeply_concerned!
9
+ Object.const_set(:Concern, ::ActiveSupport::Concern)
10
+ end
11
+
12
+ def is_deeply_concerned?
13
+ defined?(::Concern) && ::Concern == ::ActiveSupport::Concern
14
+ end
15
+ end
16
+ end
17
+
18
+ include DeepConcern
19
+ end
@@ -1,3 +1,3 @@
1
1
  module SusanCollins
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,4 @@
1
+ module SusanCollins::VeryConcerning
2
+ end
3
+
4
+ require "active_support/core_ext/module/concerning"
@@ -3,8 +3,8 @@ require_relative 'lib/susan_collins/version'
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "susan_collins"
5
5
  spec.version = SusanCollins::VERSION
6
- spec.authors = ["Jonathan Allard"]
7
- spec.email = ["jonathan@allard.io"]
6
+ spec.authors = ["Jonathan Allard", "Anonymous contributors"]
7
+ spec.email = ["jonathan@allard.io", "nobody@github.com"]
8
8
 
9
9
  spec.summary = %q{Use Concern everywhere!}
10
10
 
@@ -31,4 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.bindir = "exe"
32
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
33
  spec.require_paths = ["lib"]
34
+
35
+ spec.add_dependency "activesupport"
34
36
  end
metadata CHANGED
@@ -1,19 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: susan_collins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Allard
8
+ - Anonymous contributors
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
12
  date: 2020-12-19 00:00:00.000000000 Z
12
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
13
28
  description: "\n Sets ::Concern to ActiveSupport::Concern so you can use them\n
14
29
  \ everywhere without needing to type those pesky characters.\n "
15
30
  email:
16
31
  - jonathan@allard.io
32
+ - nobody@github.com
17
33
  executables: []
18
34
  extensions: []
19
35
  extra_rdoc_files: []
@@ -30,7 +46,9 @@ files:
30
46
  - bin/console
31
47
  - bin/setup
32
48
  - lib/susan_collins.rb
49
+ - lib/susan_collins/deep_concern.rb
33
50
  - lib/susan_collins/version.rb
51
+ - lib/susan_collins/very_concerning.rb
34
52
  - susan_collins.gemspec
35
53
  homepage: https://github.com/joallard/susan_collins
36
54
  licenses: