mogrify 0.0.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 +15 -0
- data/lib/mogrify.rb +38 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTAwN2I1MjgxZjNjMGYxN2U5MmM1OTQxMGE1ZjgzOTMyZmZjOThlOA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODkyNzQ1ODc2N2U1MzVkMDAxMzAxM2EwZDJmMjQ5YjI1MWZkNjdiYw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZmM4Y2QxMTY3ZmI2MGMzN2IwN2NhNmUwMTljMTMwODY1NDBhOTAwMTU1NzM0
|
10
|
+
NmZmZDljMDI2YTFkNzFlMzk5MWQ3YzhhYzAwYmI3NTY1N2I2ZTc0OTVlZTg2
|
11
|
+
MTZmMTdjZGEzNjhjOGFlMDcwODcxZTY3MWI4Y2RmNDAxYmY0MmQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDk5OTdmYTlhNGJkOTk2NmE3MDgxOTY2ZjllNTVjMWE2N2FmZGI3MzFhZDc0
|
14
|
+
NjBjODFjMjg0OGNjYTE0MWNmNmRmZjdmZTExOWE2NzhmOWIwMzg3YjNjOTE5
|
15
|
+
MWY1YTYxZGQ0MmE4NjA4OGNmYzVhZWI0MmVlYmQzMjk4YzYxNzc=
|
data/lib/mogrify.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
class Hash
|
3
|
+
def symogriform
|
4
|
+
symogriformed = {}
|
5
|
+
symogrified = self
|
6
|
+
symogrified.keys.each do |key|
|
7
|
+
if symogrified[key].is_a?(Hash)
|
8
|
+
symogrified[key] = symogrified[key].symogriform
|
9
|
+
end
|
10
|
+
end
|
11
|
+
symogriformed.merge!(symogrify(symogrified))
|
12
|
+
symogriformed
|
13
|
+
end
|
14
|
+
|
15
|
+
def symogrify part
|
16
|
+
part.keys.inject({}){|hash, key| hash.merge({symog(key) => part[key]})}
|
17
|
+
end
|
18
|
+
|
19
|
+
def symog key
|
20
|
+
key.is_a?(String) ? key.to_sym : key
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Enumerable
|
25
|
+
def hashmogrify(&block)
|
26
|
+
hash = {}
|
27
|
+
self.each do |e|
|
28
|
+
result = block.call(e)
|
29
|
+
if result.is_a?(Array)
|
30
|
+
hash[result[0]] = result[1]
|
31
|
+
else
|
32
|
+
hash[result] = e
|
33
|
+
end
|
34
|
+
end
|
35
|
+
hash
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mogrify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- J. Paul Daigle
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2011-09-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: j.paul.daigle@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/mogrify.rb
|
20
|
+
homepage:
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.0.5
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: my_gem is an awesome gem
|
43
|
+
test_files: []
|