cymbal 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circle-ruby +3 -0
- data/.prospectus +11 -0
- data/.rubocop.yml +2 -2
- data/.travis.yml +8 -13
- data/CHANGELOG.md +6 -0
- data/Gemfile +0 -1
- data/README.md +3 -4
- data/Rakefile +1 -2
- data/cymbal.gemspec +9 -8
- data/lib/cymbal.rb +21 -15
- data/spec/spec_helper.rb +7 -6
- metadata +33 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ee9a9e06c79fd269eab756e2d18fcf5f38cb47e341d6b40dd5e617ba96d7f122
|
4
|
+
data.tar.gz: 1b2f17d32c1a8f4a9df9ed648214ad669670a43efc040853d2ad94fe840f605c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 397e0188cb94631cd66a3d20264e01b0a4c0884637f5c1ad273030b4a2616d6e5d435073352b6665f92e7a98f1177a80886c3a97f7dcc18806448aa84bec7c18
|
7
|
+
data.tar.gz: 9e637d2b8067a4dde98a51dc55c6829984af6ed24f8a76d484aa02bfcc9faa6940449db611eb0a7b1b1b848d8df5eaa84a0931db271609de7188fd2ac8bba890
|
data/.circle-ruby
ADDED
data/.prospectus
ADDED
data/.rubocop.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
inherit_gem:
|
2
|
+
goodcop: .rubocop.yml
|
data/.travis.yml
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
rvm
|
5
|
-
|
6
|
-
-
|
7
|
-
- 2.0.0-p598
|
8
|
-
- 1.9.3-p551
|
1
|
+
dist: trusty
|
2
|
+
install:
|
3
|
+
- for i in $(cat .circle-ruby) ; do rvm install $i || exit 1 ; done
|
4
|
+
- for i in $(cat .circle-ruby) ; do rvm-exec $i bundle install || exit 1 ; done
|
5
|
+
script:
|
6
|
+
- for i in $(cat .circle-ruby) ; do rvm-exec $i bundle exec rake || exit 1 ; done
|
9
7
|
notifications:
|
10
8
|
email: false
|
11
|
-
|
12
|
-
|
13
|
-
- '%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}'
|
14
|
-
channels:
|
15
|
-
- irc.oftc.net#akerl
|
9
|
+
slack:
|
10
|
+
secure: 1/Sa+LXHWNwmCqeur64lUayGUtKkiq/vk33NMZINLxuzbd4Szpfx+Z0PN2gRTi/9KbWwRa51qv8QyVRD5414yv9CwXPdDGrsSIJ/6698NLNZC1gix1TlT2AvXiUNyOk8+Pyf83GbHKJQzzdIeviWABFdrOF1Jaj7IgZ9lyupzPLNKgilQUsdl5fjTDCxoULSxnUcUS0MyiAd90GmVuquOjsVBlmkn9hj9SOl3/2h4ACMqNTAZ/SGPivVW64g6F/S0EvvO/ccVGzuseFR+oE6f57OR12nh/eZPjnwQ7X2UZZqEji5w/4Ywo6GDEoBPZ6NBfn2HQXVocPP8Yke4ykckceTYYp0g/L+cehaUXWguOk+Oo2BrkNewoDGXjJEK8vzsCKZRVry7tcerKmjmkJARtixW20vL2YwX0lZE8ffwIn2vur8PBRW86tYVsxcOk5vKki0w54BnwVwtpOul78rR8OABcUJZYnBiSGPphikuKphLBE3L05uTDABORpw7/Oa6GdzAs4BK0AUHCBUMND4hs+hCPYWmY7Fb+5WfcTn24bmyefGaBkZLKJz5XOu/7dsyDKeyAIglWD4AxpW56hThukRKcaJV0V2FH8f8eJ5BKH91ZI/1W9kCLIQab7z1LQ1wCAOOxVUTFqqEFNf6gy+r18WX59owg/Kmb0/08XaHdY=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 2.0.0 / 2018-10-22
|
2
|
+
|
3
|
+
* [ADDED] Add `Cymbal.operate` which takes a block to format the keys
|
4
|
+
* [ADDED] Add `Cymbal.stringify` which converts keys to strings
|
5
|
+
* [CHANGED] Key conflicts now raise on the first individual key failure
|
6
|
+
|
1
7
|
# 1.0.0 / 2015-01-22
|
2
8
|
|
3
9
|
* [ENHANCEMENT] Stabilized API
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,10 +2,9 @@ cymbal
|
|
2
2
|
=========
|
3
3
|
|
4
4
|
[![Gem Version](https://img.shields.io/gem/v/cymbal.svg)](https://rubygems.org/gems/cymbal)
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
[![Build Status](https://img.shields.io/travis/akerl/cymbal.svg)](https://travis-ci.org/akerl/cymbal)
|
5
|
+
[![Build Status](https://img.shields.io/travis/com/akerl/cymbal.svg)](https://travis-ci.com/akerl/cymbal)
|
6
|
+
[![Coverage Status](https://img.shields.io/codecov/c/github/akerl/cymbal.svg)](https://codecov.io/github/akerl/cymbal)
|
7
|
+
[![Code Quality](https://img.shields.io/codacy/31e5cb840fdc473e9a52ef2a46501a07.svg)](https://www.codacy.com/app/akerl/cymbal)
|
9
8
|
[![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
|
10
9
|
|
11
10
|
Convert Ruby hash keys from strings to symbols for easier manipulation
|
data/Rakefile
CHANGED
@@ -7,8 +7,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
7
7
|
|
8
8
|
desc 'Run Rubocop on the gem'
|
9
9
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
10
|
-
task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
|
11
10
|
task.fail_on_error = true
|
12
11
|
end
|
13
12
|
|
14
|
-
task default: [
|
13
|
+
task default: %i[spec rubocop build install]
|
data/cymbal.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'cymbal'
|
3
|
-
s.version = '
|
4
|
-
s.date = Time.now.strftime(
|
3
|
+
s.version = '2.0.0'
|
4
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
5
5
|
|
6
6
|
s.summary = 'Converts hash keys from strings to symbols'
|
7
|
-
s.description =
|
7
|
+
s.description = 'Allows saner hash key manipulation by converting keys to symbols' # rubocop:disable Metrics/LineLength
|
8
8
|
s.authors = ['Les Aker']
|
9
9
|
s.email = 'me@lesaker.org'
|
10
10
|
s.homepage = 'https://github.com/akerl/cymbal'
|
@@ -13,9 +13,10 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.files = `git ls-files`.split
|
14
14
|
s.test_files = `git ls-files spec/*`.split
|
15
15
|
|
16
|
-
s.add_development_dependency '
|
17
|
-
s.add_development_dependency '
|
18
|
-
s.add_development_dependency '
|
19
|
-
s.add_development_dependency '
|
20
|
-
s.add_development_dependency '
|
16
|
+
s.add_development_dependency 'codecov', '~> 0.1.1'
|
17
|
+
s.add_development_dependency 'fuubar', '~> 2.3.0'
|
18
|
+
s.add_development_dependency 'goodcop', '~> 0.6.0'
|
19
|
+
s.add_development_dependency 'rake', '~> 12.3.0'
|
20
|
+
s.add_development_dependency 'rspec', '~> 3.8.0'
|
21
|
+
s.add_development_dependency 'rubocop', '~> 0.59.0'
|
21
22
|
end
|
data/lib/cymbal.rb
CHANGED
@@ -3,28 +3,34 @@
|
|
3
3
|
module Cymbal
|
4
4
|
class << self
|
5
5
|
def symbolize(obj)
|
6
|
-
|
7
|
-
return symbolize_array(obj) if obj.is_a? Array
|
8
|
-
obj
|
6
|
+
operate(obj, &:to_sym)
|
9
7
|
end
|
10
8
|
|
11
|
-
|
9
|
+
def stringify(obj)
|
10
|
+
operate(obj, &:to_s)
|
11
|
+
end
|
12
12
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
13
|
+
def operate(obj, &block)
|
14
|
+
return operate_hash(obj, &block) if obj.is_a? Hash
|
15
|
+
return operate_array(obj, &block) if obj.is_a? Array
|
16
|
+
obj
|
16
17
|
end
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
private
|
20
|
+
|
21
|
+
def operate_hash(hash, &block)
|
22
|
+
hash.each_with_object({}) do |(k, v), o|
|
23
|
+
new_key = yield k
|
24
|
+
o[new_key] = operate(v, &block)
|
25
|
+
if new_key != k && hash.key?(new_key)
|
26
|
+
raise ArgumentError, "Key collision in hash: #{new_key}"
|
27
|
+
end
|
28
|
+
o[new_key] = operate(v, &block)
|
29
|
+
end
|
20
30
|
end
|
21
31
|
|
22
|
-
def
|
23
|
-
|
24
|
-
other.map!(&:to_sym)
|
25
|
-
overlap = other & symbols
|
26
|
-
return if overlap.empty?
|
27
|
-
fail ArgumentError, "Key collision in hash: #{overlap}"
|
32
|
+
def operate_array(array, &block)
|
33
|
+
array.map { |item| operate(item, &block) }
|
28
34
|
end
|
29
35
|
end
|
30
36
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
|
2
|
-
require '
|
3
|
-
|
4
|
-
SimpleCov.formatter =
|
5
|
-
SimpleCov.start do
|
6
|
-
|
1
|
+
if ENV['CI'] == 'true'
|
2
|
+
require 'simplecov'
|
3
|
+
require 'codecov'
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
5
|
+
SimpleCov.start do
|
6
|
+
add_filter '/spec/'
|
7
|
+
end
|
7
8
|
end
|
8
9
|
|
9
10
|
require 'rspec'
|
metadata
CHANGED
@@ -1,92 +1,108 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cymbal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: codecov
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.1.1
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: fuubar
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.3.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: goodcop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.6.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.6.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 12.3.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 12.3.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
75
|
+
version: 3.8.0
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.
|
82
|
+
version: 3.8.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 0.59.0
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 0.59.0
|
83
97
|
description: Allows saner hash key manipulation by converting keys to symbols
|
84
98
|
email: me@lesaker.org
|
85
99
|
executables: []
|
86
100
|
extensions: []
|
87
101
|
extra_rdoc_files: []
|
88
102
|
files:
|
103
|
+
- ".circle-ruby"
|
89
104
|
- ".gitignore"
|
105
|
+
- ".prospectus"
|
90
106
|
- ".rspec"
|
91
107
|
- ".rubocop.yml"
|
92
108
|
- ".travis.yml"
|
@@ -119,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
135
|
version: '0'
|
120
136
|
requirements: []
|
121
137
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.7.6
|
123
139
|
signing_key:
|
124
140
|
specification_version: 4
|
125
141
|
summary: Converts hash keys from strings to symbols
|