Project

attrocity

0.0
No commit activity in last 3 years
No release in over 3 years
You should totally be using Virtus instead of this
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.4
~> 3.4

Runtime

~> 3.4
 Project Readme

Attrocity

You should totally be using Virtus instead. This gem is a work in progress.

The original code for this gem was written as an employee of RentPath. Since I left RentPath in April 2015, the gem has not been touched, so I'm taking over.

Installation

Add this line to your application's Gemfile:

gem 'attrocity'

And then execute:

$ bundle

Or install it yourself as:

$ gem install attrocity

Usage

Don't. Not yet.

Objects

Mappers

A mapper is responsible for extracting values from source data. A mapper object responds to call and accepts as arguments to call: the instantiated model object and the source data hash.

The default, built-in mapper is KeyMapper. When no mapper is explicitly declared, KeyMapper is used. It simply fetches from the source data hash, using the attribute name as hash key and falling back to nil as default.

Coercers

Coercers translate mapped data into the correct type. For example, the string '1' is coerced to the integer 1 if the built-in integer coercer is used.

The built-in coercers are: string, integer, and boolean.

Custom coercers are the primary way of extracting data when the built-in coercers are not sufficient for the use case.

[ ... more stuff on custom coercers here ... ]

Contributing

  1. Fork it ( https://github.com/[my-github-username]/attrocity/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request