Skip to content

Commit

Permalink
add nested storage to README
Browse files Browse the repository at this point in the history
  • Loading branch information
Leif Gensert committed Jan 11, 2014
1 parent 0054ad4 commit 0dd8261
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,25 @@ You can directly access nested values in the hashes:
# {first_name: 'Bruce',last_name: 'Wayne'},
# ]


It is also possible to store values in a nested hash:

class Wrapper < Morfo::Base
map :first_name, [:superhero, :name, :first]
map :last_name, [:superhero, :name, :last]
end

Name.morf([
{first_name: 'Clark',last_name: 'Kent'},
{first_name: 'Bruce',last_name: 'Wayne'},,
])

# [
# { superhero: {name: { first: 'Clark', last: 'Kent'}}},
# { superhero: {name: { first: 'Bruce', last: 'Wayne'}}},
# ]


## Contributing

1. Fork it
Expand Down

0 comments on commit 0dd8261

Please sign in to comment.