mash 0.0.3 → 0.0.5
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/History.txt +8 -0
- data/README.txt +14 -3
- data/Rakefile +1 -11
- data/lib/mash.rb +5 -5
- data/mash.gemspec +14 -0
- data/spec/mash_spec.rb +7 -0
- metadata +12 -18
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 0.0.5 / 2008-04-29
|
2
|
+
|
3
|
+
* [bugfix] Mashes do not infinite loop when initialized with another Mash.
|
4
|
+
|
5
|
+
=== 0.0.4 / 2008-04-25
|
6
|
+
|
7
|
+
* Setting up for GitHub gem hosting instead of Rubyforge.
|
8
|
+
|
1
9
|
=== 0.0.3 / 2008-04-19
|
2
10
|
|
3
11
|
* [] no longer defaults to a new Mash, will return nil if
|
data/README.txt
CHANGED
@@ -26,17 +26,28 @@ to JSON and XML parsed hashes.
|
|
26
26
|
|
27
27
|
== INSTALL:
|
28
28
|
|
29
|
-
|
29
|
+
Gem:
|
30
30
|
|
31
|
-
|
31
|
+
Mash is hosted on the GitHub gem repository, so if you haven't already:
|
32
|
+
|
33
|
+
gem sources -a http://gems.github.com/
|
34
|
+
sudo gem install mbleigh-mash
|
32
35
|
|
33
36
|
Git:
|
34
37
|
|
35
38
|
git clone git://github.com/mbleigh/mash.git
|
39
|
+
|
40
|
+
== RESOURCES
|
41
|
+
|
42
|
+
If you encounter any problems or have ideas for new features
|
43
|
+
please report them at the Lighthouse project for Mash:
|
44
|
+
|
45
|
+
http://mbleigh.lighthouseapp.com/projects/10112-mash
|
36
46
|
|
37
47
|
== LICENSE:
|
38
48
|
|
39
|
-
Copyright (c) 2008 Michael Bleigh
|
49
|
+
Copyright (c) 2008 Michael Bleigh (http://mbleigh.com/)
|
50
|
+
and Intridea Inc. (http://intridea.com/), released under the MIT license
|
40
51
|
|
41
52
|
Permission is hereby granted, free of charge, to any person obtaining
|
42
53
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -1,18 +1,8 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
1
|
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
2
|
require './lib/mash.rb'
|
6
3
|
require 'spec/rake/spectask'
|
7
4
|
|
8
|
-
Hoe.new('mash', Mash::VERSION) do |p|
|
9
|
-
p.rubyforge_name = 'mash-hash' # if different than lowercase project name
|
10
|
-
p.developer('Michael Bleigh', 'michael@intridea.com')
|
11
|
-
p.remote_rdoc_dir = ''
|
12
|
-
end
|
13
|
-
|
14
5
|
desc "Run specs."
|
15
6
|
Spec::Rake::SpecTask.new("spec") do |t|
|
16
7
|
t.spec_files = "spec/*_spec.rb"
|
17
|
-
end
|
18
|
-
# vim: syntax=Ruby
|
8
|
+
end
|
data/lib/mash.rb
CHANGED
@@ -128,14 +128,14 @@ class Mash < Hash
|
|
128
128
|
# Recursively merges this mash with the passed
|
129
129
|
# in hash, merging each hash in the hierarchy.
|
130
130
|
def deep_update(other_hash)
|
131
|
-
|
132
|
-
|
131
|
+
other_hash = other_hash.stringify_keys unless other_hash.is_a?(Mash)
|
132
|
+
other_hash.each_pair do |k,v|
|
133
133
|
k = convert_key(k)
|
134
134
|
self[k] = self[k].to_mash if self[k].is_a?(Hash) unless self[k].is_a?(Mash)
|
135
|
-
if self[k].is_a?(Hash) &&
|
136
|
-
self[k].deep_merge!(
|
135
|
+
if self[k].is_a?(Hash) && other_hash[k].is_a?(Hash)
|
136
|
+
self[k].deep_merge!(other_hash[k])
|
137
137
|
else
|
138
|
-
self.send(k + "=", convert_value(
|
138
|
+
self.send(k + "=", convert_value(other_hash[k]))
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
data/mash.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "mash"
|
3
|
+
s.version = "0.0.5"
|
4
|
+
s.date = "2008-04-26"
|
5
|
+
s.summary = "An extended Hash that gives simple pseudo-object functionality that can be built from hashes and easily extended"
|
6
|
+
s.email = "michael@intridea.com"
|
7
|
+
s.homepage = "http://github.com/mbleigh/mash"
|
8
|
+
s.summary = "Mash is an extended Hash that gives simple pseudo-object functionality that can be built from hashes and easily extended"
|
9
|
+
s.has_rdoc = true
|
10
|
+
s.authors = ["Michael Bleigh"]
|
11
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "mash.gemspec", "lib/mash.rb", "spec/mash_spec.rb","spec/spec_helper.rb"]
|
12
|
+
s.rdoc_options = ["--main", "README.txt"]
|
13
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
14
|
+
end
|
data/spec/mash_spec.rb
CHANGED
@@ -88,6 +88,13 @@ describe Mash do
|
|
88
88
|
converted.a.first.b.should == 12
|
89
89
|
converted.a.last.should == 23
|
90
90
|
end
|
91
|
+
|
92
|
+
it "should convert an existing Mash into a Mash" do
|
93
|
+
initial = Mash.new(:name => 'randy')
|
94
|
+
copy = Mash.new(initial)
|
95
|
+
initial.name.should == copy.name
|
96
|
+
end
|
97
|
+
|
91
98
|
end
|
92
99
|
end
|
93
100
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -9,21 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-04-
|
12
|
+
date: 2008-04-26 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
version_requirements: !ruby/object:Gem::Requirement
|
19
|
-
requirements:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.5.1
|
23
|
-
version:
|
24
|
-
description: Mash is an extended Hash that gives simple pseudo-object functionality that can be built from hashes and easily extended. It is designed to be used in RESTful API libraries to provide easy object-like access to JSON and XML parsed hashes.
|
25
|
-
email:
|
26
|
-
- michael@intridea.com
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: michael@intridea.com
|
27
18
|
executables: []
|
28
19
|
|
29
20
|
extensions: []
|
@@ -37,11 +28,14 @@ files:
|
|
37
28
|
- Manifest.txt
|
38
29
|
- README.txt
|
39
30
|
- Rakefile
|
31
|
+
- mash.gemspec
|
40
32
|
- lib/mash.rb
|
41
33
|
- spec/mash_spec.rb
|
42
34
|
- spec/spec_helper.rb
|
43
35
|
has_rdoc: true
|
44
36
|
homepage: http://github.com/mbleigh/mash
|
37
|
+
licenses: []
|
38
|
+
|
45
39
|
post_install_message:
|
46
40
|
rdoc_options:
|
47
41
|
- --main
|
@@ -62,10 +56,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
56
|
version:
|
63
57
|
requirements: []
|
64
58
|
|
65
|
-
rubyforge_project:
|
66
|
-
rubygems_version: 1.
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.3.5
|
67
61
|
signing_key:
|
68
|
-
specification_version:
|
62
|
+
specification_version: 3
|
69
63
|
summary: Mash is an extended Hash that gives simple pseudo-object functionality that can be built from hashes and easily extended
|
70
64
|
test_files: []
|
71
65
|
|