pres 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -4
- data/lib/pres/presenter.rb +2 -1
- data/lib/pres/version.rb +1 -1
- data/lib/pres/view_delegation.rb +2 -4
- data/lib/pres.rb +0 -2
- metadata +3 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b18f746158fe027b9d0cd1f39b721031470c73f1
|
4
|
+
data.tar.gz: 5c83294f9fef973829a413e401d34c9be26b861f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 234823803f8bb4972733e96dd700af6a7149ea5bfb8742e84531f72f1cb44dfdb8267164d84505b4282fa5bf8a83c5218041e0f3d7a169161140294ac4472c1b
|
7
|
+
data.tar.gz: 382e89787d1aed899ec35bb96554450af23495a55d0f7145274f3dd45739f96be41e04b7fbacf0a3da0e9b812bb5b17dbc49ac2b57213462ca7e22c6e72c40fe
|
data/README.md
CHANGED
@@ -254,12 +254,11 @@ by default, instead of whitelisting methods on the wrapped model explicitly.
|
|
254
254
|
Delegating everything to the model by default is how the `draper` gem works, for example.
|
255
255
|
|
256
256
|
```ruby
|
257
|
-
class DogePresenter <
|
257
|
+
class DogePresenter < DelegateClass(Doge)
|
258
258
|
include Pres::ViewDelegation
|
259
259
|
|
260
|
-
# you need to write your own initializer with SimpleDelegator
|
261
260
|
def initialize(object, view_context, options = {})
|
262
|
-
super
|
261
|
+
super(object)
|
263
262
|
@view_context = view_context
|
264
263
|
end
|
265
264
|
```
|
@@ -268,7 +267,7 @@ class DogePresenter < SimpleDelegator
|
|
268
267
|
= doge.name
|
269
268
|
```
|
270
269
|
|
271
|
-
see [
|
270
|
+
see [DelegateClass](https://ruby-doc.org/stdlib-2.4.0/libdoc/delegate/rdoc/Object.html)
|
272
271
|
|
273
272
|
## Updating to version 1.0
|
274
273
|
|
data/lib/pres/presenter.rb
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
# Construct with object, view_context, and optional options
|
3
3
|
module Pres
|
4
4
|
class Presenter
|
5
|
+
extend Forwardable
|
5
6
|
include Presents
|
6
7
|
include ViewDelegation
|
7
8
|
|
8
9
|
attr_reader :object, :options
|
9
10
|
|
10
|
-
|
11
|
+
def_delegators :object, :id, :to_partial_path
|
11
12
|
|
12
13
|
def initialize(object, view_context = nil, options = {})
|
13
14
|
@object = object
|
data/lib/pres/version.rb
CHANGED
data/lib/pres/view_delegation.rb
CHANGED
data/lib/pres.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pres
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tee Parham
|
@@ -9,22 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: activesupport
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '4.0'
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '4.0'
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: bundler
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,20 +39,6 @@ dependencies:
|
|
53
39
|
- - "~>"
|
54
40
|
- !ruby/object:Gem::Version
|
55
41
|
version: '5.5'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: mocha
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '1.1'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '1.1'
|
70
42
|
- !ruby/object:Gem::Dependency
|
71
43
|
name: rake
|
72
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
88
|
version: '0'
|
117
89
|
requirements: []
|
118
90
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.6.
|
91
|
+
rubygems_version: 2.6.10
|
120
92
|
signing_key:
|
121
93
|
specification_version: 4
|
122
94
|
summary: A Simple Rails Presenter
|