functional_hash 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/lib/functional_hash/version.rb +1 -1
- data/lib/functional_hash.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4626f00abe819f9a997665541f23a1df6b84bf2c
|
4
|
+
data.tar.gz: f3cc6b4b70c433a2c490c542641ddd303a3ca21b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 516aa4a754941e1b7241379313fa4e3685d8fc5e6a50d4cc7acced2b1c5763bf4ebe57dd65c4e0315d0641f46171b4e589c267068ba6066346ee86e791633dd9
|
7
|
+
data.tar.gz: 0a9b61706f365f7ca7c5fc470ea9111a3353e03eb7bf364fd442d3c746b39e4e3970ab1d85daa18502165fdcc4168711242c70152c0d0e44ef7126a8aefe8293
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in functional_hash.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
# Put gems only used in local deveopment in Gemfile.dev, and they'll be loaded
|
7
|
+
# here.
|
8
|
+
eval(IO.read('./Gemfile.dev'), binding) if File.exist? './Gemfile.dev'
|
data/lib/functional_hash.rb
CHANGED
@@ -12,4 +12,24 @@ class FunctionalHash < Hash
|
|
12
12
|
super(key)
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
def self.enable!
|
17
|
+
unless Hash.respond_to? :fn
|
18
|
+
Hash.class_eval do
|
19
|
+
def fn
|
20
|
+
FunctionalHash.new.tap do |fh|
|
21
|
+
self.each do |key, val|
|
22
|
+
fh[key] = val
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.disable!
|
31
|
+
if Hash.instance_methods.include? :fn
|
32
|
+
Hash.class_eval { undef_method :fn }
|
33
|
+
end
|
34
|
+
end
|
15
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: functional_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Myers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|