mingle_event_changes 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mingle_event_changes/change.rb +48 -1
- metadata +2 -2
@@ -41,7 +41,26 @@ module MingleEventChanges
|
|
41
41
|
|
42
42
|
class Change
|
43
43
|
include SAXMachine
|
44
|
-
|
44
|
+
element :change, :value => :type, :as => :type
|
45
|
+
|
46
|
+
# return a string description of the change
|
47
|
+
# return nil for non-content change type, e.g. card-creation
|
48
|
+
def desc
|
49
|
+
end
|
50
|
+
|
51
|
+
protected
|
52
|
+
def display_value(value)
|
53
|
+
case value
|
54
|
+
when UserValue
|
55
|
+
value.name
|
56
|
+
when CardValue
|
57
|
+
"##{value.number}"
|
58
|
+
when CardTypeValue
|
59
|
+
value.name
|
60
|
+
else
|
61
|
+
value
|
62
|
+
end || '(not set)'
|
63
|
+
end
|
45
64
|
end
|
46
65
|
|
47
66
|
class CardCopyChange < Change
|
@@ -52,6 +71,14 @@ module MingleEventChanges
|
|
52
71
|
class NameChange < Change
|
53
72
|
element :old_value
|
54
73
|
element :new_value
|
74
|
+
|
75
|
+
def desc
|
76
|
+
if old_value
|
77
|
+
"Name: \n from: #{old_value}\n to: #{new_value}"
|
78
|
+
else
|
79
|
+
"Name: #{new_value}"
|
80
|
+
end
|
81
|
+
end
|
55
82
|
end
|
56
83
|
|
57
84
|
class PropertyChange < Change
|
@@ -68,6 +95,11 @@ module MingleEventChanges
|
|
68
95
|
value(new_value_subject)
|
69
96
|
end
|
70
97
|
|
98
|
+
def desc
|
99
|
+
"#{property_definition.name}: #{display_value(old_value)} => #{display_value(new_value)}"
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
71
103
|
def value(subject)
|
72
104
|
case property_definition.data_type
|
73
105
|
when 'user'
|
@@ -93,19 +125,34 @@ module MingleEventChanges
|
|
93
125
|
def new_value
|
94
126
|
new_value_subject.card_type
|
95
127
|
end
|
128
|
+
|
129
|
+
def desc
|
130
|
+
"Type: #{display_value(old_value)} => #{display_value(new_value)}"
|
131
|
+
end
|
96
132
|
end
|
97
133
|
|
98
134
|
class TagChange < Change
|
99
135
|
element :tag
|
136
|
+
|
137
|
+
def desc
|
138
|
+
"#{self.type}: #{tag}"
|
139
|
+
end
|
100
140
|
end
|
101
141
|
|
102
142
|
class AttachmentChange < Change
|
103
143
|
element :url
|
104
144
|
element :file_name
|
145
|
+
def desc
|
146
|
+
"#{self.type}: #{file_name}"
|
147
|
+
end
|
105
148
|
end
|
106
149
|
|
107
150
|
class CommentChange < Change
|
108
151
|
element :comment
|
152
|
+
|
153
|
+
def desc
|
154
|
+
comment
|
155
|
+
end
|
109
156
|
end
|
110
157
|
|
111
158
|
class Changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mingle_event_changes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sax-machine
|