tainted_hash 0.0.2 → 0.1.0

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.
data/lib/tainted_hash.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'set'
2
2
 
3
3
  class TaintedHash < Hash
4
- VERSION = "0.0.2"
4
+ VERSION = "0.1.0"
5
5
 
6
6
  class UnexposedError < StandardError
7
7
  # Builds an exception when a TaintedHash has some unexposed keys. Useful
@@ -40,8 +40,7 @@ class TaintedHash < Hash
40
40
  # new_class - Optional class used to create basic Hashes. Default: Hash.
41
41
  #
42
42
  def initialize(hash = nil, new_class = nil)
43
- @new_class = new_class || self.class.default_hash_class
44
-
43
+ @new_class = new_class || (hash && hash.class) || self.class.default_hash_class
45
44
  (@original_hash = hash || @new_class.new).keys.each do |key|
46
45
  key_s = key.to_s
47
46
  next if key_s == key
@@ -4,7 +4,7 @@ TaintedHash.send :include, TaintedHash::RailsMethods
4
4
 
5
5
  module TaintedHash::Controller
6
6
  def wrap_params_with_tainted_hash
7
- @_params = TaintedHash.new(@_params.to_hash, HashWithIndifferentAccess)
7
+ @_params = TaintedHash.new(@_params)
8
8
  end
9
9
  end
10
10
 
data/tainted_hash.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  ## If your rubyforge_project name is different, then edit it and comment out
13
13
  ## the sub! line in the Rakefile
14
14
  s.name = 'tainted_hash'
15
- s.version = '0.0.2'
15
+ s.version = '0.1.0'
16
16
  s.date = '2013-05-21'
17
17
  s.rubyforge_project = 'tainted_hash'
18
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tainted_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: