matchable 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 20eea165b65f710ddb8430164ad48ac52a4893382b7ce73065964b3d35fcc5e3
4
+ data.tar.gz: e1e50759a271a337147ef19c44c9f95d0725ef2f9556cdecbdb2e0a8d09ef9e9
5
+ SHA512:
6
+ metadata.gz: 5d1ec0a429ed529641461774b7ea5bab46e49e41c2fe7cabe1d91d2357d935b44c5a26e778ac111d35a9e272147bb77de843a4cba960a0ff623204cf3019584e
7
+ data.tar.gz: fd72d05a74294d517a31dbfdfbc750c40c0bc84e4c2da3c7fd00c09f8009314d2c709789b467bf298d949a0d7ab05d0fc65e876a77a9ae5b3f26660732cde8f3
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 3.0.0
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.3
17
+ bundle install
18
+ bundle exec rake
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at keystonelemur@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in matchable.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+ gem "guard-rspec"
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ matchable (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.3)
10
+ diff-lcs (1.4.4)
11
+ ffi (1.14.2)
12
+ formatador (0.2.5)
13
+ guard (2.16.2)
14
+ formatador (>= 0.2.4)
15
+ listen (>= 2.7, < 4.0)
16
+ lumberjack (>= 1.0.12, < 2.0)
17
+ nenv (~> 0.1)
18
+ notiffany (~> 0.0)
19
+ pry (>= 0.9.12)
20
+ shellany (~> 0.0)
21
+ thor (>= 0.18.1)
22
+ guard-compat (1.2.1)
23
+ guard-rspec (4.7.3)
24
+ guard (~> 2.1)
25
+ guard-compat (~> 1.1)
26
+ rspec (>= 2.99.0, < 4.0)
27
+ listen (3.4.1)
28
+ rb-fsevent (~> 0.10, >= 0.10.3)
29
+ rb-inotify (~> 0.9, >= 0.9.10)
30
+ lumberjack (1.2.8)
31
+ method_source (1.0.0)
32
+ nenv (0.3.0)
33
+ notiffany (0.1.3)
34
+ nenv (~> 0.1)
35
+ shellany (~> 0.0)
36
+ pry (0.13.1)
37
+ coderay (~> 1.1)
38
+ method_source (~> 1.0)
39
+ rake (13.0.3)
40
+ rb-fsevent (0.10.4)
41
+ rb-inotify (0.10.1)
42
+ ffi (~> 1.0)
43
+ rspec (3.10.0)
44
+ rspec-core (~> 3.10.0)
45
+ rspec-expectations (~> 3.10.0)
46
+ rspec-mocks (~> 3.10.0)
47
+ rspec-core (3.10.1)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-expectations (3.10.1)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-mocks (3.10.2)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.10.0)
55
+ rspec-support (3.10.2)
56
+ shellany (0.0.1)
57
+ thor (1.1.0)
58
+
59
+ PLATFORMS
60
+ x86_64-darwin-19
61
+
62
+ DEPENDENCIES
63
+ guard-rspec
64
+ matchable!
65
+ rake (~> 13.0)
66
+ rspec (~> 3.0)
67
+
68
+ BUNDLED WITH
69
+ 2.2.3
@@ -0,0 +1,15 @@
1
+ guard :rspec, cmd: "bundle exec rspec" do
2
+ require "guard/rspec/dsl"
3
+
4
+ dsl = Guard::RSpec::Dsl.new(self)
5
+
6
+ # RSpec files
7
+ rspec = dsl.rspec
8
+ watch(rspec.spec_helper) { rspec.spec_dir }
9
+ watch(rspec.spec_support) { rspec.spec_dir }
10
+ watch(rspec.spec_files)
11
+
12
+ # Ruby files
13
+ ruby = dsl.ruby
14
+ dsl.watch_spec_files_for(ruby.lib_files)
15
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Brandon Weaver
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,135 @@
1
+ # Matchable
2
+
3
+ Pattern Matching interfaces made easy for Ruby 3.0+
4
+
5
+ ## Usage
6
+
7
+ `Matchable` works very much like other `-able` interfaces in Ruby:
8
+
9
+ ```ruby
10
+ class Something
11
+ include Matchable
12
+ end
13
+ ```
14
+
15
+ ### Basic Example
16
+
17
+ It exposes two methods, `deconstruct` and `deconstruct_keys`, after the instance methods by the same name which are used as Pattern Matching hooks in Ruby for `Array`-like and `Hash`-like matches:
18
+
19
+ ```ruby
20
+ class Card
21
+ include Matchable
22
+
23
+ deconstruct :to_a
24
+ deconstruct_keys :suit, :rank
25
+
26
+ attr_reader :suit, :rank
27
+
28
+ def initialize(suit, rank)
29
+ @suit = suit
30
+ @rank = rank
31
+ end
32
+
33
+ def to_a() = [@suit, @rank]
34
+ end
35
+ ```
36
+
37
+ The above code will generate the following effective code within the `Card` class for you:
38
+
39
+ ```ruby
40
+ class Card
41
+ def deconstruct
42
+ to_a
43
+ end
44
+
45
+ def deconstruct_keys(keys)
46
+ deconstructed_values = {}
47
+
48
+ if keys.nil? || keys.include?(:suit)
49
+ deconstructed_values[:suit] = suit
50
+ end
51
+
52
+ if keys.nil? || keys.include?(:rank)
53
+ deconstructed_values[:rank] = rank
54
+ end
55
+
56
+ deconstructed_values
57
+ end
58
+ end
59
+ ```
60
+
61
+ It should be noted that `nil` is passed to `deconstruct_keys` when no values are provided or when a `**rest` pattern is present in the match. In these cases all values should be returned, hence the `keys.nil? ||` check, which is correct.
62
+
63
+ The generated code is optimized to only include keys which are being directly matched against, guarding against loading more data than is necessary, and all in one line of code above.
64
+
65
+ In the case of `deconstruct` this method could be anything as long as it returns an `Array`. `to_a` is the most intuitive of these methods, but calling this is not required if you have more unique usecases.
66
+
67
+ ### Deconstructing `new`
68
+
69
+ `Matchable` diverges from more vanilla Ruby in that adding a `deconstruct` against `new` will not alias the method like above, it will treat the constructor itself as the attributes to deconstruct. Consider this `Person` class:
70
+
71
+ ```ruby
72
+ class Person
73
+ include Matchable
74
+
75
+ deconstruct :new
76
+ deconstruct_keys :name, :age
77
+
78
+ attr_reader :name, :age
79
+
80
+ def initialize(name, age)
81
+ @name = name
82
+ @age = age
83
+ end
84
+ end
85
+ ```
86
+
87
+ By deconstructing on `new` the following code will be generated for `deconstruct`:
88
+
89
+ ```ruby
90
+ class Person
91
+ def deconstruct
92
+ [name, age]
93
+ end
94
+ end
95
+ ```
96
+
97
+ These attributes are pulled, as mentioned above, directly from the class constructor. An `attr_reader` or similar method is expected as `Matchable` will not attempt to hunt for instance variables of the same name.
98
+
99
+ If the parameter names do not match to this requirement it is advised not to use this method with `new`, and instead define your own `deconstruct` method.
100
+
101
+ As with the above `deconstruct_keys` this method is dynamically generated to directly call methods rather than use `send`-like methods for performance reasons.
102
+
103
+ ## Installation
104
+
105
+ Add this line to your application's Gemfile:
106
+
107
+ ```ruby
108
+ gem 'matchable'
109
+ ```
110
+
111
+ And then execute:
112
+
113
+ $ bundle install
114
+
115
+ Or install it yourself as:
116
+
117
+ $ gem install matchable
118
+
119
+ ## Development
120
+
121
+ 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.
122
+
123
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
124
+
125
+ ## Contributing
126
+
127
+ Bug reports and pull requests are welcome on GitHub at https://github.com/baweaver/matchable. 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/baweaver/matchable/blob/master/CODE_OF_CONDUCT.md).
128
+
129
+ ## License
130
+
131
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
132
+
133
+ ## Code of Conduct
134
+
135
+ Everyone interacting in the Matchable project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/baweaver/matchable/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "matchable"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,169 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "matchable/version"
4
+
5
+ # Interface for Pattern Matching hooks
6
+ #
7
+ # @author baweaver
8
+ # @since 0.0.1
9
+ #
10
+ module Matchable
11
+ # Constant to prepend methods and extensions to
12
+ MODULE_NAME = "MatchableDeconstructors".freeze
13
+
14
+ # Extend class methods for pattern matching hooks
15
+ def self.included(klass) = klass.extend(ClassMethods)
16
+
17
+ # Class method hooks for adding pattern matching interfaces
18
+ #
19
+ # @author baweaver
20
+ # @since 0.0.1
21
+ module ClassMethods
22
+ # Hook for the `deconstruct` instance method which triggers its definition
23
+ # based on a deconstruction method passed. If the method is not yet defined
24
+ # by the class it will wait until such a method is added to execute.
25
+ #
26
+ # @param method_name [Symbol]
27
+ # Name of the method to bind to
28
+ #
29
+ # @return [Array[status, method_name]]
30
+ def deconstruct(method_name)
31
+ return if deconstructable_module.const_defined?('DECONSTRUCTION_METHOD')
32
+
33
+ # :new should mean :initialize if one wants to match against arguments
34
+ # to :new
35
+ method_name = :initialize if method_name == :new
36
+ deconstructable_module.const_set('DECONSTRUCTION_METHOD', method_name)
37
+
38
+ # If this was called after the method was added, go ahead and attach,
39
+ # otherwise we need some trickery to make sure the method is defined
40
+ # first if they used this at the top of the class above its definition.
41
+ if method_defined?(method_name)
42
+ attach_deconstructor(method_name)
43
+ return [true, method_name]
44
+ end
45
+
46
+ # Otherwise we set a flag, and hand it to `method_added` to clean up
47
+ # after this method
48
+ @_awaited_deconstruction_method = method_name
49
+ [false, method_name]
50
+ end
51
+
52
+ # Method Added hook, will trigger only if `deconstruct` could not bind to
53
+ # a method because it didn't exist yet.
54
+ #
55
+ # @param method_name [Symbol]
56
+ # Name of the method currently being defined
57
+ #
58
+ # @return [void]
59
+ def method_added(method_name)
60
+ return unless defined?(@_awaited_deconstruction_method)
61
+ return unless @_awaited_deconstruction_method == method_name
62
+
63
+ attach_deconstructor(method_name)
64
+ remove_instance_variable(:@_awaited_deconstruction_method)
65
+
66
+ # Return is irrelevant here, mask response from `remove_instance_variable`
67
+ nil
68
+ end
69
+
70
+ # Hook for the `deconstruct_keys` method which triggers its defintion based
71
+ # on the keys passed to this method.
72
+ #
73
+ # @param *keys [Array[Symbol]]
74
+ # Keys to deconstruct values from. Each must have an associated instance
75
+ # method to work, or this will fail.
76
+ #
77
+ # @return [void]
78
+ def deconstruct_keys(*keys)
79
+ # Return early if called more than once
80
+ return if deconstructable_module.const_defined?('DECONSTRUCTION_KEYS')
81
+
82
+ # Ensure keys are symbols, then generate Ruby code for each
83
+ # key assignment branch to be used below
84
+ sym_keys = keys.map(&:to_sym)
85
+ deconstructions = sym_keys.map { deconstructed_value(_1) }.join("\n\n")
86
+
87
+ # Retain a reference to which keys we deconstruct from
88
+ deconstructable_module.const_set('DECONSTRUCTION_KEYS', sym_keys)
89
+
90
+ # `public_send` can be slow, and `to_h` and `each_with_object` can also
91
+ # be slow. This defines the direct method calls in-line to prevent
92
+ # any performance penalties to generate optimal match code.
93
+ deconstructable_module.class_eval <<~RUBY, __FILE__ , __LINE__ + 1
94
+ def deconstruct_keys(keys)
95
+ deconstructed_values = {}
96
+
97
+ #{deconstructions}
98
+
99
+ deconstructed_values
100
+ end
101
+ RUBY
102
+
103
+ # To mask the return of the above class_eval
104
+ nil
105
+ end
106
+
107
+ # Generates Ruby code for `deconstruct_keys` branches which will
108
+ # directly call the method rather than utilizing `public_send` or
109
+ # similar methods.
110
+ #
111
+ # Note that in the case of `keys` being `nil` it is expected to return
112
+ # all keys that are possible from a pattern match rather than nothing,
113
+ # hence adding this guard in every case.
114
+ #
115
+ # @param method_name [Symbol]
116
+ # Name of the method to add a deconstructed key from
117
+ #
118
+ # @return [String]
119
+ # Evaluatable Ruby code for adding a deconstructed key to requested
120
+ # values.
121
+ private def deconstructed_value(method_name)
122
+ <<~RUBY
123
+ if keys.nil? || keys.include?(:#{method_name})
124
+ deconstructed_values[:#{method_name}] = #{method_name}
125
+ end
126
+ RUBY
127
+ end
128
+
129
+ # Attaches the deconstructor to the parent class. If the method is
130
+ # initialize we want to deconstruct based on the parameters of class
131
+ # instantiation rather than alias that method, as this is a common method
132
+ # of deconstruction.
133
+ #
134
+ # @param method_name [Symbol]
135
+ # Method to deconstruct from
136
+ #
137
+ # @return [void]
138
+ private def attach_deconstructor(method_name)
139
+ i_method = instance_method(method_name)
140
+
141
+ deconstruction_code = if method_name == :initialize
142
+ param_names = i_method.parameters.map(&:last)
143
+
144
+ "[#{param_names.join(', ')}]"
145
+ else
146
+ method_name
147
+ end
148
+
149
+ deconstructable_module.class_eval <<~RUBY, __FILE__ , __LINE__ + 1
150
+ def deconstruct
151
+ #{deconstruction_code}
152
+ end
153
+ RUBY
154
+
155
+ nil
156
+ end
157
+
158
+ # Prepended module to define methods against
159
+ #
160
+ # @return [Module]
161
+ private def deconstructable_module
162
+ if const_defined?(MODULE_NAME)
163
+ const_get(MODULE_NAME)
164
+ else
165
+ const_set(MODULE_NAME, Module.new).tap(&method(:prepend))
166
+ end
167
+ end
168
+ end
169
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Matchable
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/matchable/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "matchable"
7
+ spec.version = Matchable::VERSION
8
+ spec.authors = ["Brandon Weaver"]
9
+ spec.email = ["keystonelemur@gmail.com"]
10
+
11
+ spec.summary = "Pattern Matching interfaces for Ruby classes"
12
+ spec.homepage = "https://www.github.com/baweaver/matchable"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = spec.homepage
18
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ # Uncomment to register a new dependency of your gem
30
+ # spec.add_dependency "example-gem", "~> 1.0"
31
+
32
+ # For more information and examples about making a new gem, checkout our
33
+ # guide at: https://bundler.io/guides/creating_gem.html
34
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: matchable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brandon Weaver
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-01-31 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - keystonelemur@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".github/workflows/main.yml"
21
+ - ".gitignore"
22
+ - ".rspec"
23
+ - CODE_OF_CONDUCT.md
24
+ - Gemfile
25
+ - Gemfile.lock
26
+ - Guardfile
27
+ - LICENSE.txt
28
+ - README.md
29
+ - Rakefile
30
+ - bin/console
31
+ - bin/setup
32
+ - lib/matchable.rb
33
+ - lib/matchable/version.rb
34
+ - matchable.gemspec
35
+ homepage: https://www.github.com/baweaver/matchable
36
+ licenses:
37
+ - MIT
38
+ metadata:
39
+ homepage_uri: https://www.github.com/baweaver/matchable
40
+ source_code_uri: https://www.github.com/baweaver/matchable
41
+ changelog_uri: https://www.github.com/baweaver/matchable/CHANGELOG.md
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 3.0.0
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubygems_version: 3.2.3
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: Pattern Matching interfaces for Ruby classes
61
+ test_files: []