Sha256: e103fb9211cc7d439a0988bd58f29cd2f11952ed236e789691b138169c837a87

Contents?: true

Size: 552 Bytes

Versions: 2

Compression:

Stored size: 552 Bytes

Contents

# LazyMapper

Wraps a Hash and lazily maps its attributes to rich domain objects using either a set of default mappers (for Ruby's built-in types), or custom mappers specified by the client.

The mapped values are memoized.

Example:

    class Foo < LazyMapper
      one :id, Integer, from: 'iden'
      one :created_at, Time
      one :amount, Money, map: Money.method(:parse)
      many :users, User, map: ->(u) { User.new(u) }
    end

## Documentation

See [RubyDoc](https://www.rubydoc.info/gems/lazy_mapper/0.3.1)

## License

See LICENSE file.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lazy_mapper-0.3.2 README.md
lazy_mapper-0.3.1 README.md