hashie 0.3.0 → 0.3.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.
- data/VERSION +1 -1
- data/hashie.gemspec +2 -2
- data/lib/hashie.rb +6 -6
- data/lib/hashie/hash_extensions.rb +1 -1
- data/lib/hashie/mash.rb +3 -1
- data/spec/hashie/mash_spec.rb +10 -0
- data/spec/spec.opts +2 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/hashie.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{hashie}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Bleigh"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-19}
|
13
13
|
s.description = %q{Hashie is a small collection of tools that make hashes more powerful. Currently includes Mash (Mocking Hash) and Dash (Discrete Hash).}
|
14
14
|
s.email = %q{michael@intridea.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/hashie.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'hashie/hash_extensions'
|
2
|
-
require 'hashie/hash'
|
3
|
-
require 'hashie/mash'
|
4
|
-
require 'hashie/dash'
|
5
|
-
require 'hashie/clash'
|
6
|
-
|
7
1
|
module Hashie
|
2
|
+
autoload :HashExtensions, 'hashie/hash_extensions'
|
3
|
+
autoload :PrettyInspect, 'hashie/hash_extensions'
|
4
|
+
autoload :Hash, 'hashie/hash'
|
8
5
|
autoload :Trash, 'hashie/trash'
|
6
|
+
autoload :Mash, 'hashie/mash'
|
7
|
+
autoload :Dash, 'hashie/dash'
|
8
|
+
autoload :Clash, 'hashie/clash'
|
9
9
|
end
|
data/lib/hashie/mash.rb
CHANGED
@@ -86,7 +86,7 @@ module Hashie
|
|
86
86
|
alias_method :regular_dup, :dup
|
87
87
|
# Duplicates the current mash as a new mash.
|
88
88
|
def dup
|
89
|
-
|
89
|
+
self.class.new(self, self.default)
|
90
90
|
end
|
91
91
|
|
92
92
|
def key?(key)
|
@@ -141,6 +141,8 @@ module Hashie
|
|
141
141
|
|
142
142
|
def convert_value(val, duping=false) #:nodoc:
|
143
143
|
case val
|
144
|
+
when ::Hashie::Mash
|
145
|
+
val.dup
|
144
146
|
when ::Hash
|
145
147
|
val = val.dup if duping
|
146
148
|
self.class.new(val)
|
data/spec/hashie/mash_spec.rb
CHANGED
@@ -90,6 +90,16 @@ describe Hashie::Mash do
|
|
90
90
|
record.son.class.should == MyMash
|
91
91
|
end
|
92
92
|
|
93
|
+
it "should not change the class of Mashes when converted" do
|
94
|
+
class SubMash < Hashie::Mash
|
95
|
+
end
|
96
|
+
|
97
|
+
record = Hashie::Mash.new
|
98
|
+
son = SubMash.new
|
99
|
+
record['submash'] = son
|
100
|
+
record['submash'].should be_kind_of(SubMash)
|
101
|
+
end
|
102
|
+
|
93
103
|
describe '#respond_to?' do
|
94
104
|
it 'should respond to a normal method' do
|
95
105
|
Hashie::Mash.new.should be_respond_to(:key?)
|
data/spec/spec.opts
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Bleigh
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-19 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|