little_decorator 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/lib/helpers/little_decorator_helper.rb +1 -0
- data/lib/little_decorator.rb +0 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14063ed2711d5b817ca16b4845ac75590a7d6cd4
|
4
|
+
data.tar.gz: 9d0b50a484d9e5852bfd6e7755fdf7f292f5bb59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67b1e50486e0024512381efb15db5dbd645d468fa67da97386c36df0068b17f5293a965f1bc646d9bba2a37b52f5790d669b40885069d6cbfefae513708bd1aa
|
7
|
+
data.tar.gz: d5256ac2e34d9226916c7eef19b58a4eb10f717086d7dec154e6a3e05937dda6c22c2076e9467dbcb34d23977e22c9d10b1a7bb8df40eb0e007afb7f9a90d602
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
[](http://badge.fury.io/rb/little_decorator)
|
2
|
+
[](https://codeclimate.com/github/vicramon/little_decorator)
|
3
|
+
[](https://travis-ci.org/vicramon/little_decorator)
|
2
4
|
|
3
5
|

|
4
6
|
|
5
|
-
|
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
|
-
|
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 `
|
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
|
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
|
|
data/lib/little_decorator.rb
CHANGED
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.
|
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
|
+
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
|