cymbal 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 92033473641cd7fd0a17714e9c643efc7bbd99e2
4
+ data.tar.gz: 9f78b26897b20caf1a1a25d3001d4bfbda61e87c
5
+ SHA512:
6
+ metadata.gz: cb8b4cdf5f60fd2b7e4afd1f73c0d82a43c3d6266bc92beddd1e2b52d4ba9b4cade17b94373181c1087b82ceb9bdb89d376910d544833978cb2b7335d0f018ae
7
+ data.tar.gz: bc4d96f4ae64b77ca6e3cf89a82c19304202470e350e888a6fa8a62255eb74e81193e0dd0ac6a1eccbf9533aff9d055b677736595f7ff915cb4162069d26fe5d
@@ -0,0 +1,5 @@
1
+ pkg/*.gem
2
+ coverage/
3
+ .coveralls.yml
4
+ .bundle
5
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format Fuubar
2
+ --color
@@ -0,0 +1,2 @@
1
+ Encoding:
2
+ Enabled: false
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.1.0
5
+ - 2.0.0
6
+ - 1.9.3
7
+ notifications:
8
+ email: false
9
+ irc:
10
+ template:
11
+ - '%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}'
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Les Aker
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.
22
+
@@ -0,0 +1,34 @@
1
+ cymbal
2
+ =========
3
+
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)
9
+ [![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
10
+
11
+ Convert Ruby hash keys from strings to symbols for easier manipulation
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ require 'cymbal'
17
+ x = {
18
+ 'foo' => 1,
19
+ 'bar' => {
20
+ 'cats' => 6,
21
+ 'dogs' => 'better'
22
+ }
23
+ }
24
+ Cymbal.symbolize(x) # returns {:foo=>1, :bar=>{:cats=>6, :dogs=>"better"}}
25
+ ```
26
+
27
+ ## Installation
28
+
29
+ gem install cymbal
30
+
31
+ ## License
32
+
33
+ cymbal is released under the MIT License. See the bundled LICENSE file for details.
34
+
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ desc 'Run tests'
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ desc 'Run Rubocop on the gem'
9
+ RuboCop::RakeTask.new(:rubocop) do |task|
10
+ task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
11
+ task.fail_on_error = true
12
+ end
13
+
14
+ task default: [:spec, :rubocop, :build, :install]
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'cymbal'
3
+ s.version = '0.0.1'
4
+ s.date = Time.now.strftime("%Y-%m-%d")
5
+
6
+ s.summary = 'Converts hash keys from strings to symbols'
7
+ s.description = "Allows saner hash key manipulation by converting keys to symbols"
8
+ s.authors = ['Les Aker']
9
+ s.email = 'me@lesaker.org'
10
+ s.homepage = 'https://github.com/akerl/cymbal'
11
+ s.license = 'MIT'
12
+
13
+ s.files = `git ls-files`.split
14
+ s.test_files = `git ls-files spec/*`.split
15
+
16
+ s.add_development_dependency 'rubocop', '~> 0.26.0'
17
+ s.add_development_dependency 'rake', '~> 10.3.2'
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'
21
+ end
@@ -0,0 +1,21 @@
1
+ ##
2
+ # Convert hash keys to symbols
3
+ module Cymbal
4
+ class << self
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
9
+ end
10
+
11
+ private
12
+
13
+ def symbolize_hash(hash)
14
+ hash.each_with_object({}) { |(k, v), o| o[k.to_sym] = symbolize(v) }
15
+ end
16
+
17
+ def symbolize_array(array)
18
+ array.map { symbolize(i) }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1 @@
1
+ require 'spec_helper'
@@ -0,0 +1,10 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
5
+ SimpleCov.start do
6
+ add_filter '/spec/'
7
+ end
8
+
9
+ require 'rspec'
10
+ require 'cymbal'
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cymbal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Les Aker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.26.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.26.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.3.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 10.3.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.1
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.1.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: fuubar
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.0
83
+ description: Allows saner hash key manipulation by converting keys to symbols
84
+ email: me@lesaker.org
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - ".gitignore"
90
+ - ".rspec"
91
+ - ".rubocop.yml"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - LICENSE
95
+ - README.md
96
+ - Rakefile
97
+ - cymbal.gemspec
98
+ - lib/cymbal.rb
99
+ - spec/cymbal_spec.rb
100
+ - spec/spec_helper.rb
101
+ homepage: https://github.com/akerl/cymbal
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.2.2
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Converts hash keys from strings to symbols
125
+ test_files:
126
+ - spec/cymbal_spec.rb
127
+ - spec/spec_helper.rb