Project

makup

0.0
No release in over 3 years
Low commit activity in last 3 years
Makup for Draper decorator. Localize numbers, dates and times. Provides a way for overriding the way specific types are decorated
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

<= 5.0, >= 1.2
< 5.0.0, >= 3.2
 Project Readme

Makup

Decorator helper and makup for Draper decorator.

Build Status Coverage Status Code Climate Dependency Status Gem Version

Instalation

Add this line to your application's Gemfile:

gem 'makup'

And then execute:

$ bundle

Usage

Create your decorator as a regular draper decorator. When you try to output a date you will have an internacionalized date.

decorator.created_at # => "Fri, 27 Dec 2013 20:29:51 -02:00"

Overriding/Adding global behavior

Overriding

# app/helpers/some_helper.rb
module SomeHelper
  def decorate_Time(value)
    I18n.l(value, format: :short)
  end
end


decorator.created_at # 27 Dec 20:29

Creating new makups

# app/helpers/some_helper.rb
module SomeHelper
  def decorate_Money(value)
    helper.number_to_currency(value)
  end
end

decorator.price # => "$ 5.00"

Authors

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature) Do not forget to write tests
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request