aromat 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 69a931058f7a2bfcba4839c6816eedafe8977143
4
+ data.tar.gz: 0714cf02e7c3da5db1949bdf5a13e5de1762353a
5
+ SHA512:
6
+ metadata.gz: 4a1d877ea36647e377a64c28154707b4e71f933a33f9eb28fe045d1f7f85cdbb2f2297cf69b1965e41a177e07bc455e63ecf5b0756e07508deef71debc5a0815
7
+ data.tar.gz: 13c3091aacf29e9de3ec1965fa903cb0d50ebe7572ffc7c9404c3342dd7dd43a25c55818b0ed716c56907a42252520cff75f4732613680bcdee17acb65f76955
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .idea
2
+ Gemfile.lock
3
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Paul Duncan
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,36 @@
1
+ # Aromat
2
+
3
+ Small extensions to Ruby core libraries to make your life easier
4
+
5
+ ## Presentation
6
+
7
+ This library provides a few extensions to the Ruby core libraries in order to simplify use of some common patterns.
8
+
9
+ ## Installation
10
+
11
+ ### Gemfile
12
+ ```ruby
13
+ gem 'aromat'
14
+ ```
15
+
16
+ ### Terminal
17
+ ```bash
18
+ gem install -V aromat
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Symbolize Keys
24
+
25
+ A _sym_keys_ method is monkey-patched into the *Array* and *Hash* classes, and provides a way to recursively convert *keys* to *symbols*.
26
+ This is mostly useful when loading Hashes from external resources (YAML, CSV, JSON, etc...), where keys will be stored as strings.
27
+
28
+ ```ruby
29
+ a = { 'foo' => 'bar', 'nested' => [{ 'problems' => 'none' }] }
30
+ a.sym_keys
31
+ # => {:foo=>"bar", :nested=>[{:problems=>"none"}]}
32
+ ```
33
+
34
+ ## License
35
+
36
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'rake/testtask'
2
+ require 'bundler/gem_tasks'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ t.pattern = 'test/**/test*.rb'
7
+ end
8
+
9
+ task :default => :test
data/aromat.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aromat/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'aromat'
8
+ spec.version = Aromat::VERSION
9
+ spec.authors = ['Eresse']
10
+ spec.email = ['eresse@eresse.net']
11
+
12
+ spec.summary = 'Small extensions to Ruby core libraries to make your life easier'
13
+ spec.description = 'Provides a few extensions to the Ruby core libraries'
14
+ spec.homepage = 'http://redmine.eresse.net/projects/aromat'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler'
21
+ spec.add_development_dependency 'rake'
22
+ spec.add_runtime_dependency 'minitest'
23
+ end
@@ -0,0 +1,24 @@
1
+ # Aromat
2
+ # by Eresse <eresse@eresse.net>
3
+
4
+ # Monkey-patch Array Class
5
+ class Array
6
+
7
+ # Symbolize Keys
8
+ # Recursively symbolizes hash keys
9
+ # @return [Array] A copy of the original array where each element has had its keys recursively symbolized
10
+ def sym_keys
11
+ collect { |e| e.respond_to?(:sym_keys) ? e.sym_keys : e }
12
+ end
13
+ end
14
+
15
+ # Monkey-patch Hash Class
16
+ class Hash
17
+
18
+ # Symbolize Keys
19
+ # Recursively symbolizes hash keys
20
+ # @return [Hash] A copy of the original hash where each element has had its keys recursively symbolized
21
+ def sym_keys
22
+ Hash[*(inject([]) { |a, e| (a << (e[0].respond_to?(:to_sym) ? e[0].to_sym : e[0])) << (e[1].respond_to?(:sym_keys) ? e[1].sym_keys : e[1]) })]
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ # Aromat
2
+ # by Eresse <eresse@eresse.net>
3
+
4
+ # Aromat Module
5
+ module Aromat
6
+
7
+ # Version
8
+ VERSION = '0.1.1'
9
+ end
data/lib/aromat.rb ADDED
@@ -0,0 +1,11 @@
1
+ # Aromat
2
+ # by Eresse <eresse@eresse.net>
3
+
4
+ # Internal Includes
5
+ require 'aromat/version'
6
+ require 'aromat/sym_keys'
7
+
8
+ # Aromat Module
9
+ # Root Module for Aromat
10
+ module Aromat
11
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aromat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Eresse
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Provides a few extensions to the Ruby core libraries
56
+ email:
57
+ - eresse@eresse.net
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - aromat.gemspec
68
+ - lib/aromat.rb
69
+ - lib/aromat/sym_keys.rb
70
+ - lib/aromat/version.rb
71
+ homepage: http://redmine.eresse.net/projects/aromat
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.6.10
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Small extensions to Ruby core libraries to make your life easier
95
+ test_files: []