presenter_object 0.1.0 → 0.1.1
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/base.rb +16 -7
- 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: 31375ecaeddf2aa9d215d0985271735cfc7eff98
|
4
|
+
data.tar.gz: b4e69bdbdb37235b2f7542ce12aece07535d0e30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22d91b069467c4a01937bf3ef571888b4cfbce321e670321747d2c309994135e74d0694cd7822719fa328506ac2b1f1ee611f4856ceb92cb89e7f65e94e0effe
|
7
|
+
data.tar.gz: c231031737a1051f84a90762ca0cc0bfd1ca32a0c72f6f0b454367224a9a824ada5ecf1868a4f3edb5dcaa861efd66f72fcd768b35b21eef7f5ab242da330f59
|
@@ -32,18 +32,27 @@ class PresenterObject::Base
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
attr_reader :object, :class
|
35
|
+
attr_reader :object, :class, :view_context
|
36
36
|
|
37
|
-
def initialize(object)
|
38
|
-
@object, @class = object, object.class
|
37
|
+
def initialize(object, view_context)
|
38
|
+
@object, @class, @view_context = object, object.class, view_context
|
39
39
|
end
|
40
40
|
|
41
41
|
def method_missing(name, *args, &block)
|
42
|
-
|
43
|
-
|
42
|
+
if @object.respond_to? name
|
43
|
+
@object.send name, *args, &block
|
44
|
+
elsif @view_context.respond_to? name
|
45
|
+
@view_context.send name, *args, &block
|
46
|
+
else
|
47
|
+
super
|
48
|
+
end
|
44
49
|
end
|
45
50
|
|
46
51
|
def respond_to?(name, include_private = false)
|
47
|
-
object.respond_to?
|
52
|
+
if @object.respond_to?(name, include_private) || @view_context.respond_to?(name, include_private)
|
53
|
+
true
|
54
|
+
else
|
55
|
+
super
|
56
|
+
end
|
48
57
|
end
|
49
|
-
end
|
58
|
+
end
|