ur 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/ur/request_and_response.rb +8 -0
- data/lib/ur/version.rb +1 -1
- data/lib/ur/weblink.rb +16 -10
- data/lib/ur.rb +1 -1
- data/ur.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a9b51f120da021be44f14991d4dc1d726fb58b5b70a4bd595ad29ca8af12fff
|
4
|
+
data.tar.gz: 373234337bf222a869de55a7bf5bd9ccda0ccf54b469e109832f6962856937ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 916a05043d591e85b189b364550eca8944302a88b35402d8f46b1a588489cd756039e3dc226c2f3940aa77116d6f3669481f74c9bf620c11766a3dbc09f4ca7e
|
7
|
+
data.tar.gz: a6e10766c94d53c3c8a2f87e7d2b911f808cb1ee32a04732e8058c98822a8674b5e1bcd7471f83102a642bc3d5a5767f4e4263b68fe0257d10d7fd04b32bb009
|
data/CHANGELOG.md
CHANGED
@@ -41,6 +41,14 @@ module Ur
|
|
41
41
|
content_type ? content_type.media_type : nil
|
42
42
|
end
|
43
43
|
|
44
|
+
# @return [Enumerable<Weblink>]
|
45
|
+
def links
|
46
|
+
headers.each do |k, v|
|
47
|
+
return(Weblink.parse_link_value(v, ur.request.uri)) if k =~ /\Alink\z/i
|
48
|
+
end
|
49
|
+
[].freeze
|
50
|
+
end
|
51
|
+
|
44
52
|
# is our content type JSON?
|
45
53
|
# @return [Boolean]
|
46
54
|
def json?
|
data/lib/ur/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
UR_VERSION = "0.2.
|
1
|
+
UR_VERSION = "0.2.5".freeze
|
data/lib/ur/weblink.rb
CHANGED
@@ -46,24 +46,25 @@ module Ur
|
|
46
46
|
while !ss.eos?
|
47
47
|
# get the target_uri, within some angle brackets
|
48
48
|
ss.scan(/\s*<([^>]+)>/) || parse_fail.call
|
49
|
-
target_uri = ss[1]
|
49
|
+
target_uri = JSI::Util.uri(ss[1].freeze)
|
50
50
|
attributes = {}
|
51
51
|
while ss.scan(ATTRIBUTE_PAIR)
|
52
|
-
attributes[ss[1]] = ss[2] || ss[3]
|
52
|
+
attributes[ss[1].freeze] = (ss[2] || ss[3]).freeze
|
53
53
|
end
|
54
|
-
links << new(target_uri, attributes, context_uri)
|
54
|
+
links << new(target_uri, attributes.freeze, context_uri)
|
55
55
|
unless ss.eos?
|
56
56
|
# either the string ends or has a comma followed by another link
|
57
57
|
ss.scan(/\s*,\s*/) || parse_fail.call
|
58
58
|
end
|
59
59
|
end
|
60
|
-
links
|
60
|
+
links.freeze
|
61
61
|
end
|
62
62
|
|
63
63
|
def initialize(target_uri, attributes, context_uri=nil)
|
64
|
-
@target_uri =
|
64
|
+
@target_uri = JSI::Util.uri(target_uri)
|
65
65
|
@attributes = attributes
|
66
|
-
@context_uri =
|
66
|
+
@context_uri = JSI::Util.uri(context_uri)
|
67
|
+
freeze
|
67
68
|
end
|
68
69
|
|
69
70
|
# the context uri of the link, as an Addressable URI. this URI must be absolute, and the target_uri
|
@@ -117,11 +118,16 @@ module Ur
|
|
117
118
|
"<#{target_uri}>" + attributes.map { |k,v| %Q(; #{k}="#{v}") }.join('')
|
118
119
|
end
|
119
120
|
|
120
|
-
|
121
|
+
include(JSI::Util::Private::FingerprintHash::Immutable)
|
121
122
|
|
122
|
-
#
|
123
|
-
def
|
124
|
-
|
123
|
+
# @private
|
124
|
+
def jsi_fingerprint
|
125
|
+
{
|
126
|
+
class: Weblink,
|
127
|
+
target_uri: @target_uri,
|
128
|
+
attributes: @attributes,
|
129
|
+
context_uri: @context_uri,
|
130
|
+
}.freeze
|
125
131
|
end
|
126
132
|
end
|
127
133
|
end
|
data/lib/ur.rb
CHANGED
@@ -96,7 +96,7 @@ module Ur
|
|
96
96
|
|
97
97
|
# Ur#logger_tags applies tags from a tagged logger to this ur's metadata.
|
98
98
|
# note: ur does not log anything and this logger is not stored.
|
99
|
-
# @param
|
99
|
+
# @param logger a tagged logger
|
100
100
|
# @return [void]
|
101
101
|
def logger_tags(logger)
|
102
102
|
if logger && logger.formatter.respond_to?(:current_tags)
|
data/ur.gemspec
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.8.
|
19
|
+
version: 0.8.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.8.
|
26
|
+
version: 0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: addressable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|