Sha256: 49599c884c679ac1c26cf7a86589908e4f812d5016a3a7f56ae696be64863b54

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

= Attribute Cartographer

* http://github.com/krishicks/attribute-cartographer

== DESCRIPTION

Attribute Cartographer allows you to map an attributes hash into similarly or differently named methods, using an optional block to map the values as well.

== INSTALL

Add attribute-cartography to your Gemfile

  gem 'attribute-cartographer'

Then run:

  $ bundle

== USAGE
  class Mapper
    include AttributeCartographer

    map :a, :b
    map :c, :d, ->(v) { v.downcase }
  end

  account = Mapper.new a: 123, c: "Mapper"
  account.b # => 123
  account.d # => "Mapper"
  account.original_attributes # => { a: 123, c: "Mapper" }

== REQUIREMENTS

* Ruby 1.9.x

== LICENSE

MIT

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attribute_cartographer-0.0.1 README