simpre 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simpre/helper.rb +9 -3
- data/lib/simpre/presenter.rb +3 -0
- data/lib/simpre/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dc40f25d30355671a427638f7a35949dcd93b2a
|
4
|
+
data.tar.gz: 4413d0944e2ca4575c75b886032f1d3eb8a8bf23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 868ad1b7a1f31dffccc93f0f1c635e51731e08de3a33f578ae725ea313faa351f9ea5f4bfc3699f5b8bc25d523ef2916eee36aadbf047036d8477ef6b19091f4
|
7
|
+
data.tar.gz: 3b875cda3597592c0b1c9bcdbc446e5aca515e1e70dc5a1eb9677f7a20baadeaedce8453fc7a42eefe788bccf955d0dec42867b3cf26c8009823b20a3b0a82cf
|
data/lib/simpre/helper.rb
CHANGED
@@ -5,10 +5,16 @@ module Simpre
|
|
5
5
|
item_or_collection.map { |item| decorate(item) }
|
6
6
|
else
|
7
7
|
item = item_or_collection
|
8
|
-
|
9
|
-
return item if
|
10
|
-
|
8
|
+
presenter = "#{item.class}Presenter".constantize
|
9
|
+
return item if item.instance_of?(presenter)
|
10
|
+
presenter.new(item, current_view_context)
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def current_view_context
|
17
|
+
is_a?(ApplicationController) ? view_context : self
|
18
|
+
end
|
13
19
|
end
|
14
20
|
end
|
data/lib/simpre/presenter.rb
CHANGED
data/lib/simpre/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simpre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Dyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|