little_decorator 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97f62e2eafec5e0d0e22153528ca392aaf34a4ec
4
- data.tar.gz: 99fdb46542f2870961e2530463f896b9f1d172a1
3
+ metadata.gz: 14063ed2711d5b817ca16b4845ac75590a7d6cd4
4
+ data.tar.gz: 9d0b50a484d9e5852bfd6e7755fdf7f292f5bb59
5
5
  SHA512:
6
- metadata.gz: 2f45e99d3ada64a464a7bcca2f24f20e81009112bff0850b23ea2f1b85763f3886c71f78ca14b2aa22a6d2b204fd2fffb061dfc6b656a70b316455cae41b162c
7
- data.tar.gz: 597c1af108ff2bce6a43945a1b58bf691cda207e42e87b74fc0bb8816d84181b756fc4f6b52ddd132fe685bb943dcf90ae8c90ce435a2f12dda707d8cdabd4f3
6
+ metadata.gz: 67b1e50486e0024512381efb15db5dbd645d468fa67da97386c36df0068b17f5293a965f1bc646d9bba2a37b52f5790d669b40885069d6cbfefae513708bd1aa
7
+ data.tar.gz: d5256ac2e34d9226916c7eef19b58a4eb10f717086d7dec154e6a3e05937dda6c22c2076e9467dbcb34d23977e22c9d10b1a7bb8df40eb0e007afb7f9a90d602
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
- [![Code Climate](https://codeclimate.com/github/vicramon/interior_decorator.png)](https://codeclimate.com/github/vicramon/interior_decorator)
1
+ [![Gem Version](https://badge.fury.io/rb/little_decorator.svg)](http://badge.fury.io/rb/little_decorator)
2
+ [![Code Climate](http://img.shields.io/codeclimate/github/kabisaict/flow.svg)](https://codeclimate.com/github/vicramon/little_decorator)
3
+ [![Travis CI](https://travis-ci.org/vicramon/little_decorator.svg?branch=master)](https://travis-ci.org/vicramon/little_decorator)
2
4
 
3
5
  ![LittleDecorator: a rails model decorator. A cute husky with sunglasses proclaims his surprise at how small this gem is.](http://i.imgur.com/e0YvqjJ.png)
4
6
 
5
- Ultra lightweight decorator for Rails models. LittleDecorator has just 42 actionable lines of code.
7
+ LittleDecorator is an ultra-lightweight decorator for Rails models. There are only **42** lines of code in lib.
6
8
 
7
9
  ## Installation
8
10
 
@@ -27,7 +29,7 @@ class UserDecorator < LittleDecorator
27
29
  end
28
30
 
29
31
  def updated_at
30
- model.updated_at.strftime("%A, %B %e, %Y")
32
+ record.updated_at.strftime("%A, %B %e, %Y")
31
33
  end
32
34
 
33
35
  end
@@ -35,13 +37,13 @@ end
35
37
 
36
38
  Method calls are sent to the model via `method_missing`, so you can call model methods directly as in the `full_name` method defined above.
37
39
 
38
- Call model methods with `model` when you want to override a method but still get to the original model.
40
+ Call model methods with `record` when you want to override a method but still get to the original model.
39
41
 
40
42
  You can access helper methods and route helpers in your decorators.
41
43
 
42
44
  ### Decorate Your Objects
43
45
 
44
- You can call `decorate` on an object or a collection in both controllers and views. Examples below.
46
+ The API consists of a single method: `decorate`. This method will be available in your controllers and views. You can call `decorate` on an object or a collection. Examples:
45
47
 
46
48
  #### In Controllers
47
49
 
@@ -1,3 +1,4 @@
1
+ require 'active_support/concern'
1
2
  module LittleDecoratorHelper
2
3
  extend ActiveSupport::Concern
3
4
  included { helper_method :decorate, :d }
@@ -2,7 +2,6 @@ require 'helpers/little_decorator_helper'
2
2
  ActiveSupport.on_load(:action_controller) { include LittleDecoratorHelper }
3
3
 
4
4
  class LittleDecorator
5
-
6
5
  attr_reader :record, :view
7
6
 
8
7
  def self.decorate(record_or_collection, view)
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: little_decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vic Ramon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appraisal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec
15
29
  requirement: !ruby/object:Gem::Requirement