restfully 0.8.3 → 0.8.4

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.
@@ -96,6 +96,12 @@ module Restfully
96
96
  def unserialized
97
97
  @unserialized ||= self.class.unserialize(@io)
98
98
  end
99
+
100
+ # Returns a string to display after the URI when pretty-printing
101
+ # objects.
102
+ def banner
103
+ nil
104
+ end
99
105
 
100
106
  # Without argument, returns the properties Hash obtained from calling
101
107
  # #unserialized.
@@ -199,6 +199,12 @@ module Restfully
199
199
  true
200
200
  end
201
201
  end
202
+
203
+ def banner
204
+ if property("name")
205
+ " name=#{property("name").inspect}"
206
+ end
207
+ end
202
208
 
203
209
  # Only for collections
204
210
  def each(*args, &block)
@@ -58,7 +58,11 @@ module Restfully
58
58
  # Returns the "signature" of the resource. Used for (pretty-)inspection.
59
59
  def signature(closed=true)
60
60
  s = "#<#{kind}:0x#{object_id.to_s(16)}"
61
- s += " uri=#{uri.to_s}"
61
+ s += media_type.banner unless media_type.banner.nil?
62
+ # Only display path if host and port are the same than session's URI:
63
+ s += " uri=#{[uri.host, uri.port] == [
64
+ session.uri.host, session.uri.port
65
+ ] ? uri.request_uri.inspect : uri.to_s.inspect}"
62
66
  s += ">" if closed
63
67
  s
64
68
  end
@@ -1,3 +1,3 @@
1
1
  module Restfully
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restfully
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 3
10
- version: 0.8.3
9
+ - 4
10
+ version: 0.8.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cyril Rohr