snaky_hash 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e99b35c24440f1bdfff52d7df4819b0d3aa662bdbe22a6d71d1c80830229fc92
4
+ data.tar.gz: 9fa5b0c87bda98373f1fd2361aca7f5288dd37ab813f868a405dfdffc72a43b8
5
+ SHA512:
6
+ metadata.gz: 731ec98f1d8eb0538a1b707ac09bbc7ddc18489993a332a872d2e1115d5d46d0c0a814d71729788fbd01a3b01990402d60116d321aa385a745970b67ca6ce364
7
+ data.tar.gz: 671f10410a228e0989e940da413c6a13ce8404d315393cef59b9b043db05c7574afae1835c43a9728d06e81f15a9f64f01ec1c36f50d0a6564d8c703cea74a96
data/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format (since v2) is based on [Keep a Changelog v1](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## Unreleased
8
+ ### Added
9
+ ### Changed
10
+ ### Fixed
11
+ ### Removed
12
+
13
+ ## [Unreleased]
14
+
15
+ ## [1.0.1] - 2022-08-26
16
+ ### Added
17
+ - Missing LICENSE.txt file to release
18
+ ### Removed
19
+ - Accidentally added bundler dependency (vestige of transpec process) is now removed
20
+
21
+ ## [1.0.0] - 2022-08-26
22
+ ### Added
23
+ - Initial release
24
+
25
+ [Unreleased]: https://gitlab.com/oauth-xx/snaky_hash/-/compare/v1.0.1...main
26
+ [1.0.1]: https://gitlab.com/oauth-xx/snaky_hash/-/releases/tag/v1.0.1
27
+ [1.0.0]: https://gitlab.com/oauth-xx/snaky_hash/-/releases/tag/v1.0.0
@@ -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 peter.boling@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/CONTRIBUTING.md ADDED
@@ -0,0 +1,23 @@
1
+ ## Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitLab at [https://gitlab.com/oauth-xx/snaky_hash/][source]. This project is
4
+ intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
5
+ the [code of conduct][conduct].
6
+
7
+ To submit a patch, please fork the project and create a patch with
8
+ tests. Once you're happy with it send a pull request and post a message to the
9
+ [google group][mailinglist].
10
+
11
+ ## Contributors
12
+
13
+ [![Contributors](https://contrib.rocks/image?repo=oauth-xx/oauth-ruby)][contributors]
14
+
15
+ Made with [contributors-img][contrib-rocks].
16
+
17
+ [comment]: <> (Following links are used by README, CONTRIBUTING, Homepage)
18
+
19
+ [conduct]: https://gitlab.com/oauth-xx/snaky_hash/-/blob/main/CODE_OF_CONDUCT.md
20
+ [contributors]: https://gitlab.com/oauth-xx/snaky_hash/-/graphs/main
21
+ [mailinglist]: http://groups.google.com/group/oauth-ruby
22
+ [source]: https://gitlab.com/oauth-xx/snaky_hash/-/tree/main
23
+ [contrib-rocks]: https://contrib.rocks
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Peter Boling
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,40 @@
1
+ # SnakyHash
2
+
3
+ This gem is used by the `oauth` and `oauth2` gems, and others, to normalize hash keys and lookups,
4
+ and provide a nice psuedo-object interface.
5
+
6
+ It has its roots in the `Rash` (specifically the [`rash_alt`](https://github.com/shishi/rash_alt) flavor), which is a special `Mash`, made popular by the `hashie` gem.
7
+
8
+ `SnakyHash::Snake` does inherit from `Hashie::Mash` and adds some additional behaviors.
9
+
10
+ ## Installation
11
+
12
+ Install the gem and add to the application's Gemfile by executing:
13
+
14
+ $ bundle add snaky_hash
15
+
16
+ If bundler is not being used to manage dependencies, install the gem by executing:
17
+
18
+ $ gem install snaky_hash
19
+
20
+ ## Usage
21
+
22
+ For now, please see specs
23
+
24
+ ## Development
25
+
26
+ 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.
27
+
28
+ 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).
29
+
30
+ ## Contributing
31
+
32
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/snaky_hash. 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/pboling/snaky_hash/blob/main/CODE_OF_CONDUCT.md).
33
+
34
+ ## License
35
+
36
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
37
+
38
+ ## Code of Conduct
39
+
40
+ Everyone interacting in the SnakyHash project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pboling/snaky_hash/blob/main/CODE_OF_CONDUCT.md).
data/SECURITY.md ADDED
@@ -0,0 +1,22 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|--------------------|
7
+ | 1.0.x | :white_check_mark: |
8
+
9
+ ### EOL Policy
10
+
11
+ Non-commercial support for the oldest version of Ruby (which itself is going EOL) will be dropped each year in April.
12
+
13
+ ## Reporting a Vulnerability
14
+
15
+ To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
16
+ Tidelift will coordinate the fix and disclosure.
17
+
18
+ ## OAuth for Enterprise
19
+
20
+ Available as part of the Tidelift Subscription.
21
+
22
+ The maintainers of snaky_hash and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/rubygems-oauth?utm_source=rubygems-oauth&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
@@ -0,0 +1,51 @@
1
+ require "hashie/mash"
2
+
3
+ module SnakyHash
4
+ class Snake < Hashie::Mash
5
+ # This is similar to the functionality we want.
6
+ # include Hashie::Extensions::Mash::SymbolizeKeys
7
+
8
+ protected
9
+
10
+ # Converts a key to a string,
11
+ # but only if it is able to be converted to a symbol.
12
+ #
13
+ # @api private
14
+ # @param [<K>] key the key to attempt convert to a symbol
15
+ # @return [String, K]
16
+ def convert_key(key)
17
+ key.respond_to?(:to_sym) ? underscore_string(key.to_s) : key
18
+ end
19
+
20
+ # Unlike its parent Mash, a SnakyHash::Snake will convert other
21
+ # Hashie::Hash values to a SnakyHash::Snake when assigning
22
+ # instead of respecting the existing subclass
23
+ def convert_value(val, duping = false) #:nodoc:
24
+ case val
25
+ when self.class
26
+ val.dup
27
+ when ::Hash
28
+ val = val.dup if duping
29
+ self.class.new(val)
30
+ when ::Array
31
+ val.collect { |e| convert_value(e) }
32
+ else
33
+ val
34
+ end
35
+ end
36
+
37
+ # converts a camel_cased string to a underscore string
38
+ # subs spaces with underscores, strips whitespace
39
+ # Same way ActiveSupport does string.underscore
40
+ def underscore_string(str)
41
+ str.to_s.strip
42
+ .tr(" ", "_")
43
+ .gsub(/::/, "/")
44
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
45
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
46
+ .tr("-", "_")
47
+ .squeeze("_")
48
+ .downcase
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SnakyHash
4
+ module Version
5
+ VERSION = "1.0.1".freeze
6
+ end
7
+ end
data/lib/snaky_hash.rb ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # third party gems
4
+ require "hashie"
5
+ require "version_gem"
6
+
7
+ require_relative "snaky_hash/version"
8
+ require_relative "snaky_hash/snake"
9
+
10
+ module SnakyHash
11
+ end
12
+
13
+ SnakyHash::Version.class_eval do
14
+ extend VersionGem::Basic
15
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: snaky_hash
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Peter Boling
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-08-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hashie
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: version_gem
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-lts
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '8.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '8.0'
83
+ description: 'A Hashie::Mash joint to make #snakelife better'
84
+ email:
85
+ - peter.boling@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - CHANGELOG.md
91
+ - CODE_OF_CONDUCT.md
92
+ - CONTRIBUTING.md
93
+ - LICENSE.txt
94
+ - README.md
95
+ - SECURITY.md
96
+ - lib/snaky_hash.rb
97
+ - lib/snaky_hash/snake.rb
98
+ - lib/snaky_hash/version.rb
99
+ homepage: https://gitlab.com/oauth-xx/snaky_hash
100
+ licenses:
101
+ - MIT
102
+ metadata:
103
+ homepage_uri: https://gitlab.com/oauth-xx/snaky_hash
104
+ source_code_uri: https://gitlab.com/oauth-xx/snaky_hash/-/tree/v1.0.1
105
+ changelog_uri: https://gitlab.com/oauth-xx/snaky_hash/-/blob/v1.0.1/CHANGELOG.md
106
+ bug_tracker_uri: https://gitlab.com/oauth-xx/snaky_hash/-/issues
107
+ documentation_uri: https://www.rubydoc.info/gems/snaky_hash/1.0.1
108
+ wiki_uri: https://gitlab.com/oauth-xx/snaky_hash/-/wikis/home
109
+ rubygems_mfa_required: 'true'
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '2.2'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubygems_version: 3.3.21
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: A very snaky hash
129
+ test_files: []