presenter_object 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/presenter_object.rb +6 -0
- data/lib/presenter_object/presentable.rb +7 -4
- data/lib/presenter_object/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db23d97099762959c245d3fd2ca7dc4960922a0
|
4
|
+
data.tar.gz: f69f054e06a994404e89f11a9f49b7e9c0f3df35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4db85001d3aaec96bb6b98d9a19d8d12c13b4fd1e8e383984f08f42267a7ab44c69d64d5c6347dfcbc7ec11f8702cdf99548fb7ca195a3cdb6a37412447f32f0
|
7
|
+
data.tar.gz: e70d1a61d2d9c0edc6f7f67de77f6c121e1ac4e705158cb76a8a9714d72d020cbf7a635f66735f77eaa6e7bd55dcb0739eb053723439338d51d2a8b8335fa7e8
|
data/lib/presenter_object.rb
CHANGED
@@ -9,15 +9,18 @@
|
|
9
9
|
# document = Document.find(params[:id]).presenterize
|
10
10
|
#
|
11
11
|
module PresenterObject::Presentable
|
12
|
-
extend ActiveSupport::Concern
|
13
|
-
|
14
12
|
PresenterNotRegistered = Class.new KeyError
|
13
|
+
extend ActiveSupport::Concern
|
15
14
|
|
16
15
|
module ClassMethods
|
17
16
|
def presenter_class
|
18
|
-
PresenterObject::Base.presenters.fetch name
|
17
|
+
PresenterObject::Base.presenters.fetch name
|
19
18
|
rescue KeyError
|
20
|
-
|
19
|
+
if (presenter = PresenterObject.load_presenter!(name))
|
20
|
+
presenter
|
21
|
+
else
|
22
|
+
raise PresenterNotRegistered, "No presenter registered for #{name}. Is it defined and loaded?"
|
23
|
+
end
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|