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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ac3aea4adecabe1573026105b6c4c9eba8cc5af
4
- data.tar.gz: 0c59f6a42ff424048494f496d45228098a676460
3
+ metadata.gz: 4626f00abe819f9a997665541f23a1df6b84bf2c
4
+ data.tar.gz: f3cc6b4b70c433a2c490c542641ddd303a3ca21b
5
5
  SHA512:
6
- metadata.gz: 7852189e563fd171d37601138a16a33a84292d4862abefb27b18902fa3e37f436d8fd5a4ad951d9004efb8dcd086bb586a66d1af1a7f6c73be03b43b598efb24
7
- data.tar.gz: fadaa41f78e0489fe73a331100af3e98a8eb450d9f6824845a216cb3e3a42f5fbe1cdfc7f76263659f05e9bdad755159b965b05f7df89ed0b4167932b5a21dad
6
+ metadata.gz: 516aa4a754941e1b7241379313fa4e3685d8fc5e6a50d4cc7acced2b1c5763bf4ebe57dd65c4e0315d0641f46171b4e589c267068ba6066346ee86e791633dd9
7
+ data.tar.gz: 0a9b61706f365f7ca7c5fc470ea9111a3353e03eb7bf364fd442d3c746b39e4e3970ab1d85daa18502165fdcc4168711242c70152c0d0e44ef7126a8aefe8293
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
3
  /Gemfile.lock
4
+ /Gemfile.dev
4
5
  /_yardoc/
5
6
  /coverage/
6
7
  /doc/
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'
@@ -1,3 +1,3 @@
1
1
  class FunctionalHash < Hash
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -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.1.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-26 00:00:00.000000000 Z
11
+ date: 2017-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler