ismasan-hash_mapper 0.0.7 → 0.0.8
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/README.rdoc +13 -9
- data/Rakefile +1 -1
- data/lib/hash_mapper.rb +13 -3
- metadata +4 -3
data/README.rdoc
CHANGED
@@ -123,15 +123,6 @@ Just use the denormalize() method instead:
|
|
123
123
|
This will work with your block filters and even nested mappers (see below).
|
124
124
|
|
125
125
|
=== Advanced usage
|
126
|
-
==== Array access
|
127
|
-
You want:
|
128
|
-
|
129
|
-
{:names => ['Ismael', 'Celis']} converted to {:first_name => 'Ismael', :last_name => 'Celis'}
|
130
|
-
|
131
|
-
Do this:
|
132
|
-
|
133
|
-
map from('/names[0]'), to('/first_name')
|
134
|
-
map from('/names[1]'), to('/last_name')
|
135
126
|
==== Nested mappers
|
136
127
|
|
137
128
|
You want to map nested structures delegating to different mappers:
|
@@ -218,6 +209,19 @@ Note also that 'output' is correct at the time of the filter, i.e. before_normal
|
|
218
209
|
== REQUIREMENTS:
|
219
210
|
|
220
211
|
== TODO:
|
212
|
+
==== Array access
|
213
|
+
You want:
|
214
|
+
|
215
|
+
{:names => ['Ismael', 'Celis']} converted to {:first_name => 'Ismael', :last_name => 'Celis'}
|
216
|
+
|
217
|
+
Do this:
|
218
|
+
|
219
|
+
map from('/names[0]'), to('/first_name')
|
220
|
+
map from('/names[1]'), to('/last_name')
|
221
|
+
|
222
|
+
==== Optimizations
|
223
|
+
|
224
|
+
* Get rid of ActiveSupport (used for inherited class variables and HashWithIndifferentAccess)
|
221
225
|
|
222
226
|
== INSTALL:
|
223
227
|
|
data/Rakefile
CHANGED
data/lib/hash_mapper.rb
CHANGED
@@ -1,11 +1,21 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
|
+
def require_active_support
|
5
|
+
require 'active_support/core_ext/array/extract_options'
|
6
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
7
|
+
require 'active_support/core_ext/duplicable'
|
8
|
+
Array.send(:include, ActiveSupport::CoreExtensions::Array::ExtractOptions)
|
9
|
+
Hash.send(:include, ActiveSupport::CoreExtensions::Hash::IndifferentAccess)
|
10
|
+
require 'active_support/core_ext/class/inheritable_attributes'
|
11
|
+
|
12
|
+
end
|
13
|
+
|
4
14
|
begin
|
5
|
-
|
15
|
+
require_active_support
|
6
16
|
rescue LoadError
|
7
17
|
require 'rubygems'
|
8
|
-
|
18
|
+
require_active_support
|
9
19
|
end
|
10
20
|
|
11
21
|
|
@@ -30,7 +40,7 @@ unless Array.instance_methods.include?("inject_with_index")
|
|
30
40
|
end
|
31
41
|
|
32
42
|
module HashMapper
|
33
|
-
VERSION = '0.0.
|
43
|
+
VERSION = '0.0.8'
|
34
44
|
|
35
45
|
# we need this for inheritable mappers, which is annoying because it needs ActiveSupport, kinda overkill.
|
36
46
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ismasan-hash_mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Celis
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04
|
12
|
+
date: 2009-08-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- tasks/rspec.rake
|
61
61
|
has_rdoc: true
|
62
62
|
homepage: http://github.com/ismasan/hash_mapper
|
63
|
+
licenses:
|
63
64
|
post_install_message: PostInstall.txt
|
64
65
|
rdoc_options:
|
65
66
|
- --main
|
@@ -81,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
82
|
requirements: []
|
82
83
|
|
83
84
|
rubyforge_project: hash_mapper
|
84
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.3.5
|
85
86
|
signing_key:
|
86
87
|
specification_version: 2
|
87
88
|
summary: Maps values from hashes with different structures and/or key names
|