rash_alt 0.4.7 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +28 -0
- data/.gitignore +3 -0
- data/Dockerfile +10 -0
- data/README.md +97 -0
- data/lib/hashie/mash/rash.rb +1 -0
- data/lib/rash/version.rb +1 -1
- data/rash.gemspec +5 -5
- data/spec/rash_spec.rb +6 -0
- metadata +23 -23
- data/.travis.yml +0 -5
- data/README.rdoc +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1e89e219464af68e33ecf40a1fdf02a7383f71e0986f5651afe2afc3261eb95
|
4
|
+
data.tar.gz: 6ce218fce8f78e22a739be318456835feb1bd5b741a5cb7db3e36274252d6dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b6a80394ee5332f5bd788ae4c90a4c773ce112d1077a25d915fd93836062547611433a339fa873a044dba66b9aab0ca7e72f9d83c72648fe178faf8149735d7
|
7
|
+
data.tar.gz: 212038c995cdeb5209ff6eb4d8113bb13892dad36d3e74b7b12302330aef7aa63b4b2485182483ec34d9732c4d252d5a57fedc3dbc1ef8bd9b141bad92010472
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: rspec
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- "*"
|
9
|
+
jobs:
|
10
|
+
rspec:
|
11
|
+
runs-on: ${{ matrix.os }}
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
os: [ubuntu-20.04, ubuntu-18.04]
|
16
|
+
ruby: [2.5, 2.6, 2.7, 3.0]
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
with:
|
20
|
+
fetch-depth: 1
|
21
|
+
- uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
bundler-cache: true
|
25
|
+
- name: install dependency
|
26
|
+
run: bundle install
|
27
|
+
- name: run spec
|
28
|
+
run: bundle exec rake spec
|
data/.gitignore
CHANGED
data/Dockerfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# rash
|
2
|
+
|
3
|
+
[![gem version](https://img.shields.io/gem/v/rash_alt.svg)](https://rubygems.org/gems/rash_alt)
|
4
|
+
[![build status](https://github.com/shishi/rash_alt/workflows/rspec/badge.svg)](https://github.com/shishi/rash_alt/actions?query=workflow%3Arspec)
|
5
|
+
|
6
|
+
Rash is an extension to Hashie ( http://github.com/hashie/hashie ).
|
7
|
+
|
8
|
+
Rash subclasses Hashie::Mash to convert all keys in the hash to underscore.
|
9
|
+
|
10
|
+
The purpose of this is when working w/ Java (or any other apis) that return
|
11
|
+
hashes (including nested) that have camelCased keys.
|
12
|
+
|
13
|
+
You will now be able to access those keys through underscored key names
|
14
|
+
(camelCase still available).
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Add this line to your application's Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'rash_alt', require: 'rash'
|
22
|
+
```
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
```shell
|
27
|
+
$ bundle
|
28
|
+
```
|
29
|
+
|
30
|
+
Or install it yourself as:
|
31
|
+
|
32
|
+
```shell
|
33
|
+
$ gem install rash_alt
|
34
|
+
```
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
@rash = Hashie::Mash::Rash.new({
|
40
|
+
"varOne" => 1,
|
41
|
+
"two" => 2,
|
42
|
+
:three => 3,
|
43
|
+
:varFour => 4,
|
44
|
+
"fiveHumpHumps" => 5,
|
45
|
+
:nested => {
|
46
|
+
"NestedOne" => "One",
|
47
|
+
:two => "two",
|
48
|
+
"nested_three" => "three"
|
49
|
+
},
|
50
|
+
"nestedTwo" => {
|
51
|
+
"nested_two" => 22,
|
52
|
+
:nestedThree => 23
|
53
|
+
}
|
54
|
+
})
|
55
|
+
|
56
|
+
@rash.var_one # => 1
|
57
|
+
@rash.two # => 2
|
58
|
+
@rash.three # => 3
|
59
|
+
@rash.var_four # => 4
|
60
|
+
@rash.five_hump_humps # => 5
|
61
|
+
@rash.nested.nested_one # => "One"
|
62
|
+
@rash.nested.two # => "two"
|
63
|
+
@rash.nested.nested_three # => "three"
|
64
|
+
@rash.nested_two.nested_two # => 22
|
65
|
+
@rash.nested_two.nested_three # => 23
|
66
|
+
```
|
67
|
+
|
68
|
+
## Known Issue
|
69
|
+
|
70
|
+
You may have Hashie's warnings like this
|
71
|
+
|
72
|
+
```
|
73
|
+
WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash::Rash#varOne defined in Hashie::Mash::Rash. This can cause unexpected behavior when accessing the key as a property. You can still access the key via the #[] method.
|
74
|
+
```
|
75
|
+
|
76
|
+
if you want to disable this, use `disable_warnings`
|
77
|
+
https://github.com/hashie/hashie#mash
|
78
|
+
|
79
|
+
## Note on Patches/Pull Requests
|
80
|
+
|
81
|
+
* Fork the project.
|
82
|
+
* Make your feature addition or bug fix.
|
83
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
84
|
+
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
85
|
+
* Send me a pull request. Bonus points for topic branches.
|
86
|
+
|
87
|
+
## Copyright
|
88
|
+
|
89
|
+
* Copyright (c) 2010 Tom Cocca.
|
90
|
+
* Copyright (c) 2016 Shigenobu Nishikawa.
|
91
|
+
|
92
|
+
### Acknowledgements
|
93
|
+
|
94
|
+
* Intridea (https://github.com/intridea) for Hashie
|
95
|
+
* Mislav Marohnić (https://github.com/mislav) for contributions to Rash
|
96
|
+
* Steve Agalloco (https://github.com/spagalloco) for updating Rash to use bundler, rspec 2.5, hashie 1.0 and fixing some load dependencies
|
97
|
+
|
data/lib/hashie/mash/rash.rb
CHANGED
data/lib/rash/version.rb
CHANGED
data/rash.gemspec
CHANGED
@@ -6,17 +6,17 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = %q{rash_alt}
|
7
7
|
s.authors = ["tcocca", "Shigenobu Nishikawa"]
|
8
8
|
s.description = %q{simple extension to Hashie::Mash for rubyified keys, all keys are converted to underscore to eliminate horrible camelCasing}
|
9
|
-
s.email = %q{tom.cocca@gmail.com, shishi
|
9
|
+
s.email = %q{tom.cocca@gmail.com, shishi@srevo.net}
|
10
10
|
s.homepage = "https://github.com/shishi/rash_alt"
|
11
11
|
s.rdoc_options = ["--charset=UTF-8"]
|
12
12
|
s.summary = %q{simple extension to Hashie::Mash for rubyified keys}
|
13
13
|
|
14
14
|
s.version = Rash::VERSION
|
15
15
|
|
16
|
-
s.add_dependency 'hashie', '
|
17
|
-
s.add_development_dependency 'rake', '
|
18
|
-
s.add_development_dependency 'rdoc', '
|
19
|
-
s.add_development_dependency 'rspec', '
|
16
|
+
s.add_dependency 'hashie', '>= 3.4'
|
17
|
+
s.add_development_dependency 'rake', '>= 13.0.3'
|
18
|
+
s.add_development_dependency 'rdoc', '>= 6.3.0'
|
19
|
+
s.add_development_dependency 'rspec', '>= 3.4'
|
20
20
|
|
21
21
|
s.require_paths = ['lib']
|
22
22
|
s.files = `git ls-files`.split("\n")
|
data/spec/rash_spec.rb
CHANGED
@@ -48,6 +48,9 @@ describe Hashie::Mash::Rash do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should allow camelCased accessors" do
|
51
|
+
#avoiding hashie v5- warnings
|
52
|
+
subject.class.disable_warnings(:varOne)
|
53
|
+
|
51
54
|
subject.varOne.should == 1
|
52
55
|
subject.varOne = "once"
|
53
56
|
subject.varOne.should == "once"
|
@@ -55,6 +58,9 @@ describe Hashie::Mash::Rash do
|
|
55
58
|
end
|
56
59
|
|
57
60
|
it "should allow camelCased accessors on nested hashes" do
|
61
|
+
# avoiding hashie v5- warnings
|
62
|
+
subject.class.disable_warnings(:nestedOne)
|
63
|
+
|
58
64
|
subject.nested.nestedOne.should == "One"
|
59
65
|
subject.nested.nestedOne = "once"
|
60
66
|
subject.nested.nested_one.should == "once"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rash_alt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tcocca
|
@@ -9,77 +9,78 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '3.
|
20
|
+
version: '3.4'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '3.
|
27
|
+
version: '3.4'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 13.0.3
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 13.0.3
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rdoc
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 6.3.0
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 6.3.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '3.
|
62
|
+
version: '3.4'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '3.
|
69
|
+
version: '3.4'
|
70
70
|
description: simple extension to Hashie::Mash for rubyified keys, all keys are converted
|
71
71
|
to underscore to eliminate horrible camelCasing
|
72
|
-
email: tom.cocca@gmail.com, shishi
|
72
|
+
email: tom.cocca@gmail.com, shishi@srevo.net
|
73
73
|
executables: []
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".github/workflows/rspec.yml"
|
77
78
|
- ".gitignore"
|
78
79
|
- ".rspec"
|
79
|
-
-
|
80
|
+
- Dockerfile
|
80
81
|
- Gemfile
|
81
82
|
- LICENSE
|
82
|
-
- README.
|
83
|
+
- README.md
|
83
84
|
- Rakefile
|
84
85
|
- lib/hashie/mash/rash.rb
|
85
86
|
- lib/rash.rb
|
@@ -106,8 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
107
|
- !ruby/object:Gem::Version
|
107
108
|
version: '0'
|
108
109
|
requirements: []
|
109
|
-
|
110
|
-
rubygems_version: 2.7.3
|
110
|
+
rubygems_version: 3.2.3
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: simple extension to Hashie::Mash for rubyified keys
|
data/.travis.yml
DELETED
data/README.rdoc
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
= rash
|
2
|
-
|
3
|
-
{<img src="https://img.shields.io/gem/v/rash_alt.svg" alt="Gem Version" />}[https://rubygems.org/gems/rash_alt]
|
4
|
-
{<img src="https://img.shields.io/travis/shishi/rash_alt.svg" alt="Build Status" />}[https://travis-ci.org/shishi/rash_alt]
|
5
|
-
|
6
|
-
Rash is an extension to Hashie ( http://github.com/intridea/hashie )
|
7
|
-
|
8
|
-
Rash subclasses Hashie::Mash to convert all keys in the hash to underscore
|
9
|
-
|
10
|
-
The purpose of this is when working w/ Java (or any other apis) that return hashes (including nested) that have camelCased keys
|
11
|
-
|
12
|
-
You will now be able to access those keys through underscored key names (camelCase still available)
|
13
|
-
|
14
|
-
== Installation
|
15
|
-
|
16
|
-
Add this line to your application's Gemfile:
|
17
|
-
|
18
|
-
gem 'rash_alt', require: 'rash'
|
19
|
-
|
20
|
-
And then execute:
|
21
|
-
|
22
|
-
$ bundle
|
23
|
-
|
24
|
-
Or install it yourself as:
|
25
|
-
|
26
|
-
$ gem install rash_alt
|
27
|
-
|
28
|
-
== Usage
|
29
|
-
|
30
|
-
@rash = Hashie::Mash::Rash.new({
|
31
|
-
"varOne" => 1,
|
32
|
-
"two" => 2,
|
33
|
-
:three => 3,
|
34
|
-
:varFour => 4,
|
35
|
-
"fiveHumpHumps" => 5,
|
36
|
-
:nested => {
|
37
|
-
"NestedOne" => "One",
|
38
|
-
:two => "two",
|
39
|
-
"nested_three" => "three"
|
40
|
-
},
|
41
|
-
"nestedTwo" => {
|
42
|
-
"nested_two" => 22,
|
43
|
-
:nestedThree => 23
|
44
|
-
}
|
45
|
-
})
|
46
|
-
|
47
|
-
@rash.var_one # => 1
|
48
|
-
@rash.two # => 2
|
49
|
-
@rash.three # => 3
|
50
|
-
@rash.var_four # => 4
|
51
|
-
@rash.five_hump_humps # => 5
|
52
|
-
@rash.nested.nested_one # => "One"
|
53
|
-
@rash.nested.two # => "two"
|
54
|
-
@rash.nested.nested_three # => "three"
|
55
|
-
@rash.nested_two.nested_two # => 22
|
56
|
-
@rash.nested_two.nested_three # => 23
|
57
|
-
|
58
|
-
== Note on Patches/Pull Requests
|
59
|
-
|
60
|
-
* Fork the project.
|
61
|
-
* Make your feature addition or bug fix.
|
62
|
-
* Add tests for it. This is important so I don't break it in a
|
63
|
-
future version unintentionally.
|
64
|
-
* Commit, do not mess with rakefile, version, or history.
|
65
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
66
|
-
* Send me a pull request. Bonus points for topic branches.
|
67
|
-
|
68
|
-
== Copyright
|
69
|
-
|
70
|
-
* Copyright (c) 2010 Tom Cocca.
|
71
|
-
* Copyright (c) 2016 Shigenobu Nishikawa.
|
72
|
-
|
73
|
-
=== Acknowledgements
|
74
|
-
|
75
|
-
* Intridea (https://github.com/intridea) for Hashie
|
76
|
-
* Mislav Marohnić (https://github.com/mislav) for contributions to Rash
|
77
|
-
* Steve Agalloco (https://github.com/spagalloco) for updating Rash to use bundler, rspec 2.5, hashie 1.0 and fixing some load dependencies
|