Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Readme indentation and link to new github page

  • Loading branch information...
commit b854e1a5d12952369fc4e8a21d74aea8cac29023 1 parent 3d609b7
Ismael Celis authored
Showing with 17 additions and 5 deletions.
  1. +16 −4 README.md
  2. +1 −1  hash_mapper.gemspec
20 README.md
View
@@ -1,6 +1,6 @@
# hash_mapper
-* http://github.com/ismasan/hash_mapper
+* http://ismasan.github.com/hash_mapper/
## DESCRIPTION:
@@ -90,7 +90,13 @@ end
You want to make sure an incoming value gets converted to a certain type, so
```ruby
-{'one' => '1', 'two' => '2'} gets translated to {:one => 1, :two => 2}
+{'one' => '1', 'two' => '2'}
+```
+
+gets translated to
+
+```ruby`
+{:one => 1, :two => 2}
```
Do this:
@@ -147,12 +153,15 @@ You want:
```ruby
{:names => ['Ismael', 'Celis']}
```
+
converted to
+
```ruby
{:first_name => 'Ismael', :last_name => 'Celis'}
```
Do this:
+
```ruby
map from('/names[0]'), to('/first_name')
map from('/names[1]'), to('/last_name')
@@ -163,6 +172,7 @@ map from('/names[1]'), to('/last_name')
You want to map nested structures delegating to different mappers:
From this:
+
```ruby
input = {
:project => 'HashMapper',
@@ -170,7 +180,9 @@ input = {
:author_names => {:first => 'Ismael', :last => 'Celis'}
}
```
+
To this:
+
```ruby
output = {
:project_name => 'HashMapper',
@@ -197,6 +209,7 @@ end
```
Now ProjectMapper will delegate parsing of :author_names to UserMapper
+
```ruby
ProjectMapper.normalize( input ) # => output
```
@@ -261,9 +274,8 @@ Note also that 'output' is correct at the time of the filter, i.e. before_normal
## INSTALL:
-# Now install
- sudo gem install hash_mapper
+ gem install hash_mapper
## Credits:
2  hash_mapper.gemspec
View
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
"spec/spec_helper.rb",
"tasks/rspec.rake"
]
- s.homepage = %q{http://github.com/ismasan/hash_mapper}
+ s.homepage = %q{http://ismasan.github.com/hash_mapper/}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
Please sign in to comment.
Something went wrong with that request. Please try again.