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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 46af8544a2e5313854767692da1df0cf02265fe0
4
- data.tar.gz: 13eada37ae64a98ac2c69df9efc1f3344ef34980
2
+ SHA256:
3
+ metadata.gz: ee9a9e06c79fd269eab756e2d18fcf5f38cb47e341d6b40dd5e617ba96d7f122
4
+ data.tar.gz: 1b2f17d32c1a8f4a9df9ed648214ad669670a43efc040853d2ad94fe840f605c
5
5
  SHA512:
6
- metadata.gz: 149c0583d11ce168b5f7e24a7f55dc946ae9b554b389f9773b07ccbd9f97be87235f914641d42d28c407ced90b14a22a7668dbfd60d301d404d6869343a7d273
7
- data.tar.gz: 9068d1616785b54f53f961c542459f2675b05cc27e00255cc0ff069127af0dc4057838e2f828db0b0b7aea7f7c2ff12aee50649892fad305f19b2dc1c76bbec7
6
+ metadata.gz: 397e0188cb94631cd66a3d20264e01b0a4c0884637f5c1ad273030b4a2616d6e5d435073352b6665f92e7a98f1177a80886c3a97f7dcc18806448aa84bec7c18
7
+ data.tar.gz: 9e637d2b8067a4dde98a51dc55c6829984af6ed24f8a76d484aa02bfcc9faa6940449db611eb0a7b1b1b848d8df5eaa84a0931db271609de7188fd2ac8bba890
@@ -0,0 +1,3 @@
1
+ 2.5.3
2
+ 2.4.5
3
+ 2.3.8
@@ -0,0 +1,11 @@
1
+ my_slug = 'akerl/cymbal'
2
+
3
+ Prospectus.extra_dep('file', 'prospectus_travis')
4
+ Prospectus.extra_dep('file', 'prospectus_gems')
5
+
6
+ item do
7
+ noop
8
+
9
+ extend ProspectusGems::Gemspec.new
10
+ extend ProspectusTravis::Build.new(my_slug)
11
+ end
@@ -1,2 +1,2 @@
1
- Encoding:
2
- Enabled: false
1
+ inherit_gem:
2
+ goodcop: .rubocop.yml
@@ -1,15 +1,10 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
- rvm:
5
- - 2.2.0
6
- - 2.1.5
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
- irc:
12
- template:
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=
@@ -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
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
-
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
- [![Dependency Status](https://img.shields.io/gemnasium/akerl/cymbal.svg)](https://gemnasium.com/akerl/cymbal)
6
- [![Code Climate](https://img.shields.io/codeclimate/github/akerl/cymbal.svg)](https://codeclimate.com/github/akerl/cymbal)
7
- [![Coverage Status](https://img.shields.io/coveralls/akerl/cymbal.svg)](https://coveralls.io/r/akerl/cymbal)
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: [:spec, :rubocop, :build, :install]
13
+ task default: %i[spec rubocop build install]
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cymbal'
3
- s.version = '1.0.0'
4
- s.date = Time.now.strftime("%Y-%m-%d")
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 = "Allows saner hash key manipulation by converting keys to symbols"
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 'rubocop', '~> 0.28.0'
17
- s.add_development_dependency 'rake', '~> 10.4.0'
18
- s.add_development_dependency 'coveralls', '~> 0.7.1'
19
- s.add_development_dependency 'rspec', '~> 3.1.0'
20
- s.add_development_dependency 'fuubar', '~> 2.0.0'
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
@@ -3,28 +3,34 @@
3
3
  module Cymbal
4
4
  class << self
5
5
  def symbolize(obj)
6
- return symbolize_hash(obj) if obj.is_a? Hash
7
- return symbolize_array(obj) if obj.is_a? Array
8
- obj
6
+ operate(obj, &:to_sym)
9
7
  end
10
8
 
11
- private
9
+ def stringify(obj)
10
+ operate(obj, &:to_s)
11
+ end
12
12
 
13
- def symbolize_hash(hash)
14
- check_collisions(hash.keys)
15
- hash.each_with_object({}) { |(k, v), o| o[k.to_sym] = symbolize(v) }
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
- def symbolize_array(array)
19
- array.map { |item| symbolize(item) }
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 check_collisions(keys)
23
- symbols, other = keys.partition { |x| x.is_a? Symbol }
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
@@ -1,9 +1,10 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
-
4
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
5
- SimpleCov.start do
6
- add_filter '/spec/'
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: 1.0.0
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: 2015-01-22 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rubocop
14
+ name: codecov
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.28.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.28.0
26
+ version: 0.1.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: fuubar
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 10.4.0
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: 10.4.0
40
+ version: 2.3.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: coveralls
42
+ name: goodcop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.7.1
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.7.1
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.1.0
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.1.0
82
+ version: 3.8.0
69
83
  - !ruby/object:Gem::Dependency
70
- name: fuubar
84
+ name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 2.0.0
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: 2.0.0
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.2.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