Sha256: dad4a7324cbddd6d2e1d27dbc0b70992a3d4179e678edd588ee7b4834325ada7

Contents?: true

Size: 472 Bytes

Versions: 2

Compression:

Stored size: 472 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

## License

See `LICENSE` file.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lazy_mapper-0.2.0 README.md
lazy_mapper-0.1.1 README.md