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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc021d5c9372478d941b2beea539420d82de377e
4
- data.tar.gz: 54a3bd206edc161d6f414329a2c9fe885faee57d
3
+ metadata.gz: b18f746158fe027b9d0cd1f39b721031470c73f1
4
+ data.tar.gz: 5c83294f9fef973829a413e401d34c9be26b861f
5
5
  SHA512:
6
- metadata.gz: '098c8e5eb4c4c62f5ce807ee6333e232295607d732f308dfb0eb2f19a25d1d9ad81f9edbe1443c56c82d0ec807d100394234389c28e2131fb56b10ccf2782e11'
7
- data.tar.gz: 20a2b0fbe3666005827b0406fac9095afc19c28186184d4c862ffdf28b4b5537153ca1d94cba127e34f64bd52d3b37623cc1f96b5c232065284c9005a923c808
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 < SimpleDelegator
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 [SimpleDelegator](http://ruby-doc.org/stdlib-2.3.0/libdoc/delegate/rdoc/SimpleDelegator.html)
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
 
@@ -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
- delegate :id, :to_partial_path, to: :object
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
@@ -1,3 +1,3 @@
1
1
  module Pres
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -1,9 +1,7 @@
1
1
  module Pres
2
2
  module ViewDelegation
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- attr_reader :view_context
3
+ def view_context
4
+ @view_context
7
5
  end
8
6
 
9
7
  # Send missing symbols to view_context first
data/lib/pres.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "active_support/core_ext/module/delegation"
2
- require "active_support/concern"
3
1
  require "pres/version"
4
2
  require "pres/view_delegation"
5
3
  require "pres/presents"
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.3.0
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-02-01 00:00:00.000000000 Z
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.8
91
+ rubygems_version: 2.6.10
120
92
  signing_key:
121
93
  specification_version: 4
122
94
  summary: A Simple Rails Presenter