status_tag 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/status_tag/presenter.rb +8 -1
- data/lib/status_tag/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: 1820003db19578e9ff2ee219baca893e3d4d7cef
|
4
|
+
data.tar.gz: 6eb26b46cbc8074ffca7cdf0b80457e48111d24a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81431153ab80c60eff6bdf6cb3145846d8e9e75c680e8c05b116c0ff0d4fd1f71a2c2791d5473071b6d3b0665d5f1255a9211376a488b4ae1aaa6ffac8476e9d
|
7
|
+
data.tar.gz: f994ee655f93a81f5ce6b2febf0910f57167ba0db45256d13c6c5f7f9a4f35f38d6e90a1a467d5b3df4bf6618a76030d7d356230ee2c8c33f013207cb6fa3345
|
data/lib/status_tag/presenter.rb
CHANGED
@@ -17,6 +17,9 @@ module StatusTag
|
|
17
17
|
# Override constants in subclasses
|
18
18
|
ORDERED_CHOICES = [StatusTag::Choice.new]
|
19
19
|
CSS_CLASS = [] # A CSS class or classes to assign to all tags generated with the presenter
|
20
|
+
DECIDE_ON = :object # or :self, which will send the messages to the presenter class
|
21
|
+
# (which has an internal reference to object) and would allow more complicated logic that
|
22
|
+
# pertains to the view, not the model.
|
20
23
|
|
21
24
|
attr_accessor :object, # e.g. an instance of the User class
|
22
25
|
:aspect # e.g. "state", "status" or some other descriptive name for this particular status tag
|
@@ -31,7 +34,11 @@ module StatusTag
|
|
31
34
|
end
|
32
35
|
|
33
36
|
def decide
|
34
|
-
|
37
|
+
if (self.class)::DECIDE_ON == :object
|
38
|
+
decider.decide(object)
|
39
|
+
else
|
40
|
+
decider.decide(self)
|
41
|
+
end
|
35
42
|
end
|
36
43
|
|
37
44
|
# An alternative to overriding the constant in subclasses is to override this method.
|
data/lib/status_tag/version.rb
CHANGED