Sha256: 726f4cabdec49376cce8077716020f8949dd43b0462d7473c386a0b09b89ed8b
Contents?: true
Size: 820 Bytes
Versions: 1
Compression:
Stored size: 820 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-cartographer to your Gemfile gem 'attribute-cartographer' Then run: $ bundle == USAGE class Mapper include AttributeCartographer map :a map :b, ->(v) { v.downcase } map :c, :d map :e, :f, ->(v) { v.downcase } map :g, :h, ->(v) { v.downcase }, ->(v) { v.upcase } map [:i, :j, :k] map [:l, :m, :n], ->(v) { v.upcase } end mapper = Mapper.new attributes mapper.original_attributes # => {:a=>123, :c=>"Mapper", :e=>"Eee!", :f=>"F.", :g=>"Gee!"} == REQUIREMENTS * Ruby 1.9.x == LICENSE MIT
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
attribute_cartographer-0.0.2 | README |