draft_approve 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/draft_approve/draft_changes_proxy.rb +24 -3
- data/lib/draft_approve/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ca60f47abb98e39a15ed8e91908df99fe8c7e86cabd5b49f2c7af09d8dc3c81
|
4
|
+
data.tar.gz: 6131c6c3c2ab5b356b3b83008102faedb4cdd9ef91f4a3a52b9b62c01d7933c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9a69e0b14841cac940315acd0f6eaa17307b5c988c8f61ab67409ba3954b06a32840aa52786bddbc0908ef9b326fc89b29d52dcca9d3287c1dd90686d275deb
|
7
|
+
data.tar.gz: e4c22ba25d5d9f106928dc154a3b380113f32a3748d6826c016f11f15f632f5a052e0664f8f3fdf6a733aa1bbdc24ff2b44731febb1f45343f8224805f1b42bb
|
data/Gemfile.lock
CHANGED
@@ -226,13 +226,34 @@ module DraftApprove
|
|
226
226
|
|
227
227
|
# Returns a string representing the current value of the proxied object.
|
228
228
|
#
|
229
|
+
# @param include_class_and_id [Boolean] if +true+ and the proxied object
|
230
|
+
# already exists (ie. this isn't a proxy for a new draft), then append
|
231
|
+
# "<{classname} #{id}>" to the end of the returned string
|
232
|
+
#
|
229
233
|
# @return [String] the +to_s+ of the current value of the proxied object
|
230
234
|
# (ie. the value before any changes would take effect). If there is no
|
231
235
|
# current value (ie. this is a proxy for a new draft) then simply
|
232
|
-
# returns "New
|
233
|
-
|
234
|
-
|
236
|
+
# returns "New {classname}".
|
237
|
+
#
|
238
|
+
# @example
|
239
|
+
# # When draft_changes_proxy is for a new Person
|
240
|
+
# draft_changes_proxy.current_to_s
|
241
|
+
# #=> "New Person"
|
242
|
+
#
|
243
|
+
# @example
|
244
|
+
# # When draft_changes_proxy is for an existing Person
|
245
|
+
# draft_changes_proxy.current_to_s
|
246
|
+
# #=> "Joe Blogs"
|
247
|
+
#
|
248
|
+
# @example
|
249
|
+
# # When draft_changes_proxy is for an existing Person
|
250
|
+
# draft_changes_proxy.current_to_s(include_class_and_id: true)
|
251
|
+
# #=> "Joe Blogs <Person #1>"
|
252
|
+
def current_to_s(include_class_and_id: false)
|
253
|
+
if @draftable.present? && include_class_and_id
|
235
254
|
return "#{@draftable.to_s} <#{@draftable_class} ##{@draftable.id}>"
|
255
|
+
elsif @draftable.present?
|
256
|
+
return @draftable.to_s
|
236
257
|
else
|
237
258
|
# No current draftable
|
238
259
|
return "New #{@draftable_class}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draft_approve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Sibley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|