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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 778e1169104c109857ae10ab5be887080d7cd6128dbffe51e8a339fd49fff197
4
- data.tar.gz: c744acb2e0f8c2262407864860edb42c5153e498d651071f63a4fb4f0fca423d
3
+ metadata.gz: 2ca60f47abb98e39a15ed8e91908df99fe8c7e86cabd5b49f2c7af09d8dc3c81
4
+ data.tar.gz: 6131c6c3c2ab5b356b3b83008102faedb4cdd9ef91f4a3a52b9b62c01d7933c4
5
5
  SHA512:
6
- metadata.gz: da0f2ee7cca8abb87de7448178fa86fbe5e083b832c89b3d604d557602c18026c062c12bf80a5148d24507e41eec728ed4fd92780b02ae95c8724cb9c5dd2d2e
7
- data.tar.gz: d72607ca1a9dd39a82fce60863b1e2a368afbc9f5d6c3ae4ce315d51de5625bc01318a5f11d446f8af26cd456991d6236b9cbd2b9ed3417e304babfc78415acb
6
+ metadata.gz: c9a69e0b14841cac940315acd0f6eaa17307b5c988c8f61ab67409ba3954b06a32840aa52786bddbc0908ef9b326fc89b29d52dcca9d3287c1dd90686d275deb
7
+ data.tar.gz: e4c22ba25d5d9f106928dc154a3b380113f32a3748d6826c016f11f15f632f5a052e0664f8f3fdf6a733aa1bbdc24ff2b44731febb1f45343f8224805f1b42bb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- draft_approve (0.1.0)
4
+ draft_approve (0.2.0)
5
5
  activerecord (~> 5.2)
6
6
 
7
7
  GEM
@@ -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 <classname>".
233
- def current_to_s
234
- if @draftable.present?
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}"
@@ -1,3 +1,3 @@
1
1
  module DraftApprove
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-02-28 00:00:00.000000000 Z
11
+ date: 2019-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord