dio 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +70 -0
- data/Guardfile +14 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dio.gemspec +33 -0
- data/lib/dio.rb +9 -0
- data/lib/dio/dive_forwarder.rb +129 -0
- data/lib/dio/errors.rb +15 -0
- data/lib/dio/public_api.rb +12 -0
- data/lib/dio/version.rb +3 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5248afd5e7856dc4e15f32792e9da724a03a664b734b09608244eed54fc04796
|
4
|
+
data.tar.gz: 4149b6a58f5f62d9003a856f322bf61e0f22167bcf53d13afdef2f3262ea738b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 515b2931c3cfb2299917348e7bd143ebb705f1966d7ad771273b03b17ed4ef1ed1490bbeff36b21ea31ea9d079d1aa1484bcb02a63a285cebad52d80b2ddec4e
|
7
|
+
data.tar.gz: fdbeaffb6bcaaf5f380fc1834bc14ebd2ddb92a1355a91a4f3bbb2e5cda7aa054f4ba034e0beb3dd1dafce9beec4a53a23d35545b1e36e91edda007ec7fd3bd9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
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, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
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 keystonelemur@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 [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dio (0.0.1)
|
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 (10.5.0)
|
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.1)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.10.0)
|
55
|
+
rspec-support (3.10.1)
|
56
|
+
shellany (0.0.1)
|
57
|
+
thor (1.0.1)
|
58
|
+
|
59
|
+
PLATFORMS
|
60
|
+
x86_64-darwin-19
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
bundler (~> 2.0)
|
64
|
+
dio!
|
65
|
+
guard-rspec
|
66
|
+
rake (~> 10.0)
|
67
|
+
rspec (~> 3.0)
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
2.2.3
|
data/Guardfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
2
|
+
require "guard/rspec/dsl"
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
+
|
5
|
+
# RSpec files
|
6
|
+
rspec = dsl.rspec
|
7
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
8
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
9
|
+
watch(rspec.spec_files)
|
10
|
+
|
11
|
+
# Ruby files
|
12
|
+
ruby = dsl.ruby
|
13
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
14
|
+
end
|
data/LICENSE.txt
ADDED
@@ -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.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Dio - Dive Into Objects!
|
2
|
+
|
3
|
+
Dio, or "Dive Into Objects", is a wrapper for Ruby objects that do not have a
|
4
|
+
Pattern Matching interface defined, but have methods which make them able to
|
5
|
+
implement an approximation of it:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
Dio[1] in { succ: { succ: { succ: 4 } } }
|
9
|
+
# => true
|
10
|
+
```
|
11
|
+
|
12
|
+
Using this interface we can even pattern match against arbitrary objects by
|
13
|
+
treating the pattern match keys as method calls to "dive into" an object to
|
14
|
+
match against it.
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
Further usage instructions will be documented at a later date, see
|
19
|
+
`spec/dio_spec.rb` for ideas in the mean time.
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
Add this line to your application's Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'dio'
|
27
|
+
```
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
|
31
|
+
$ bundle
|
32
|
+
|
33
|
+
Or install it yourself as:
|
34
|
+
|
35
|
+
$ gem install dio
|
36
|
+
|
37
|
+
|
38
|
+
## Development
|
39
|
+
|
40
|
+
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.
|
41
|
+
|
42
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/baweaver/dio. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
51
|
+
|
52
|
+
## Code of Conduct
|
53
|
+
|
54
|
+
Everyone interacting in the Dio project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/baweaver/dio/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dio"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/dio.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "dio/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "dio"
|
7
|
+
spec.version = Dio::VERSION
|
8
|
+
spec.authors = ["Brandon Weaver"]
|
9
|
+
spec.email = ["keystonelemur@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Dive Into Objects - Pattern matching extension for plain old Ruby objects}
|
12
|
+
spec.homepage = "https://www.github.com/baweaver/dio"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
17
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
spec.add_development_dependency "guard-rspec"
|
33
|
+
end
|
data/lib/dio.rb
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
|
3
|
+
module Dio
|
4
|
+
# Allows for Pattern Matching against arbitrary objects by wrapping them
|
5
|
+
# in an interface that understands methods of deconstructing objects.
|
6
|
+
#
|
7
|
+
# **Approximating Deconstruction**
|
8
|
+
#
|
9
|
+
# As Ruby does not, by default, define `deconstruct` and `deconstruct_keys` on
|
10
|
+
# objects this class attempts to approximate them.
|
11
|
+
#
|
12
|
+
# This class does, however, do something unique in treating `deconstruct_keys`
|
13
|
+
# as a series of calls to sent to the class and its "nested" values.
|
14
|
+
#
|
15
|
+
# **Demonstrating Nested Values**
|
16
|
+
#
|
17
|
+
# Consider an integer:
|
18
|
+
#
|
19
|
+
# ```ruby
|
20
|
+
# Dio[1] in { succ: { succ: { succ: 4 } } }
|
21
|
+
# # => true
|
22
|
+
# ```
|
23
|
+
#
|
24
|
+
# It has no concept of deconstruction, except in that its `succ` method returns
|
25
|
+
# a "nested" value we can match against, allowing us to "dive into" the
|
26
|
+
# object, diving us our namesake Dio, or "Dive Into Object"
|
27
|
+
#
|
28
|
+
# **Delegation**
|
29
|
+
#
|
30
|
+
# As with most monadic-like design patterns that add additional behavior by
|
31
|
+
# wrapping objects we need to extract the value at the end to do anything
|
32
|
+
# particularly useful.
|
33
|
+
#
|
34
|
+
# By adding delegation to this class we have a cheat around this in that
|
35
|
+
# any method called on the nested DiveForwarder instances will call through
|
36
|
+
# to the associated base object instead.
|
37
|
+
#
|
38
|
+
# I am not 100% sold on this approach, and will consider it more in the
|
39
|
+
# future.
|
40
|
+
#
|
41
|
+
# @author [baweaver]
|
42
|
+
#
|
43
|
+
class DiveForwarder < ::Delegator
|
44
|
+
# Wrapper for creating a new DiveForwarder
|
45
|
+
NEW_DIVE = -> v { DiveForwarder.new(v) }
|
46
|
+
|
47
|
+
# Creates a new delegator that understands the pattern matching interface
|
48
|
+
#
|
49
|
+
# @param base_object [Any]
|
50
|
+
# Any object that does not necessarily understand pattern matching
|
51
|
+
#
|
52
|
+
# @return [DiveForwarder]
|
53
|
+
def initialize(base_object)
|
54
|
+
@base_object = base_object
|
55
|
+
end
|
56
|
+
|
57
|
+
# Approximation of an Array deconstruction:
|
58
|
+
#
|
59
|
+
# ```ruby
|
60
|
+
# [1, 2, 3] in [*, 2, *]
|
61
|
+
# ```
|
62
|
+
#
|
63
|
+
# Attempts to find a reasonable interface by which to extract values
|
64
|
+
# to be matched. If an object that knows how to match already is sent
|
65
|
+
# through wrap its child values for deeper matching.
|
66
|
+
#
|
67
|
+
# Current interface will work with `to_a`, `to_ary`, `map`, and values
|
68
|
+
# that can already `deconstruct`. If others are desired please submit a PR
|
69
|
+
# to add them
|
70
|
+
#
|
71
|
+
# @raises [Dio::Errors::NoDeconstructionMethod]
|
72
|
+
# If no method of deconstruction exists, an exception is raised to
|
73
|
+
# communicate the proper interface and note the abscense of a current one.
|
74
|
+
#
|
75
|
+
# @return [Array[DiveForwarder]]
|
76
|
+
# Values lifted into a Dio context for further matching
|
77
|
+
def deconstruct
|
78
|
+
return @base_object.deconstruct.map!(&NEW_DIVE) if @base_object.respond_to?(:deconstruct)
|
79
|
+
|
80
|
+
return @base_object.to_a.map!(&NEW_DIVE) if @base_object.respond_to?(:to_a)
|
81
|
+
return @base_object.to_ary.map!(&NEW_DIVE) if @base_object.respond_to?(:to_ary)
|
82
|
+
return @base_object.map(&NEW_DIVE) if @base_object.respond_to?(:map)
|
83
|
+
|
84
|
+
raise Dio::Errors::NoDeconstructionMethod
|
85
|
+
end
|
86
|
+
|
87
|
+
# Approximates `deconstruct_keys` for Hashes, except in adding `Qo`-like
|
88
|
+
# behavior that allows to treat objects as "nested values" through their
|
89
|
+
# method calls.
|
90
|
+
#
|
91
|
+
# **Deconstructing an Object**
|
92
|
+
#
|
93
|
+
# In `Qo` one could match against an object by calling to its methods using
|
94
|
+
# `public_send`. This allowed one to "dive into" an object through a series
|
95
|
+
# of method calls, approximating a Hash pattern match.
|
96
|
+
#
|
97
|
+
# **Native Behavior**
|
98
|
+
#
|
99
|
+
# If the object already responds to `deconstruct_keys` this method will
|
100
|
+
# behave similarly to `deconstruct` and wrap its values as new
|
101
|
+
# `DiveForwarder` contexts.
|
102
|
+
#
|
103
|
+
# @param keys [Array]
|
104
|
+
# Keys to be extracted from the object
|
105
|
+
#
|
106
|
+
# @return [Hash]
|
107
|
+
# Deconstructed keys pointing to associated values extracted from a Hash
|
108
|
+
# or an Object. Note that these values are matched against using `===`.
|
109
|
+
def deconstruct_keys(keys)
|
110
|
+
if @base_object.respond_to?(:deconstruct_keys)
|
111
|
+
@base_object
|
112
|
+
.deconstruct_keys(*keys)
|
113
|
+
.transform_values!(&NEW_DIVE)
|
114
|
+
else
|
115
|
+
keys.to_h { |k| @base_object.public_send(k).then { |v| [k, NEW_DIVE[v]] } }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Unwrapped context, aliased afterwards to use Ruby's delegator interface
|
120
|
+
#
|
121
|
+
# @return [Any]
|
122
|
+
# Originally wrapped object
|
123
|
+
def value
|
124
|
+
@base_object
|
125
|
+
end
|
126
|
+
|
127
|
+
alias_method :__getobj__, :value
|
128
|
+
end
|
129
|
+
end
|
data/lib/dio/errors.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Dio
|
2
|
+
module Errors
|
3
|
+
# Error raised when no deconstruction method is available on an object being
|
4
|
+
# treated like an Array deconstruction.
|
5
|
+
#
|
6
|
+
# @author [baweaver]
|
7
|
+
# @since 0.0.1
|
8
|
+
class NoDeconstructionMethod < StandardError
|
9
|
+
# Error message
|
10
|
+
MSG = 'Object provided no method of deconstruction (to_a, to_ary, map, Enumerable)'
|
11
|
+
|
12
|
+
def initialize(msg=MSG) = super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Dio
|
2
|
+
module PublicApi
|
3
|
+
# Treats `[]` like an alternative constructor and forwards to `DiveForwarder`
|
4
|
+
#
|
5
|
+
# @param ... [Any]
|
6
|
+
# Forwarded params
|
7
|
+
#
|
8
|
+
# @return [Dio::DiveForwarder]
|
9
|
+
# Dio pattern matching interface
|
10
|
+
def [](...) = Dio::DiveForwarder.new(...)
|
11
|
+
end
|
12
|
+
end
|
data/lib/dio/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Weaver
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- keystonelemur@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- Guardfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- dio.gemspec
|
88
|
+
- lib/dio.rb
|
89
|
+
- lib/dio/dive_forwarder.rb
|
90
|
+
- lib/dio/errors.rb
|
91
|
+
- lib/dio/public_api.rb
|
92
|
+
- lib/dio/version.rb
|
93
|
+
homepage: https://www.github.com/baweaver/dio
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata:
|
97
|
+
homepage_uri: https://www.github.com/baweaver/dio
|
98
|
+
source_code_uri: https://www.github.com/baweaver/dio
|
99
|
+
changelog_uri: https://www.github.com/baweaver/dio/CHANGELOG.md
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubygems_version: 3.2.3
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: Dive Into Objects - Pattern matching extension for plain old Ruby objects
|
119
|
+
test_files: []
|