<p></p>
<p><b>@tomhughes</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6470#discussion_r2470371976">lib/tag2link.rb</a>:</p>
<pre style='color:#555'>> @@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+module Tag2link
+ class << self
</pre>
<p dir="auto">Is there a reason for using this relatively obscure syntax rather than just using <code class="notranslate">def self.</code> to define class methods? I find it easier to understand and it's how we generally do it in other places?</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6470#discussion_r2470387787">test/lib/tag2link_test.rb</a>:</p>
<pre style='color:#555'>> + def test_link_returns_nil_for_unknown_key
+ assert_nil Tag2link.link("nonexistent_key", "SomeValue")
+ end
+
+ def test_link_returns_proper_url_for_known_key
+ url = Tag2link.link("wikidata", "Q936")
+ assert_equal "https://www.wikidata.org/entity/Q936", url
+ end
+
+ def test_build_dict_rejects_deprecated_and_third_party
+ data = [
+ { "key" => "Key:example", "url" => "http://example.com/$1", "rank" => "deprecated", "source" => "osmwiki:P8" },
+ { "key" => "Key:example2", "url" => "http://example2.com/$1", "rank" => "preferred", "source" => "wikidata:P3303" },
+ { "key" => "Key:example3", "url" => "http://example3.com/$1", "rank" => "preferred", "source" => "osmwiki:P8" }
+ ]
+ dict = Tag2link.send(:build_dict, data)
</pre>
<p dir="auto">Why the need to use <code class="notranslate">send</code> here? It's not a private method?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6470#pullrequestreview-3389899053">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNKWEXP3XEKP4NNOBD3Z6Q2TAVCNFSM6AAAAACKBQTVXSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGOBZHA4TSMBVGM">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLKKRGYSMFP25ZDH5333Z6Q2TA5CNFSM6AAAAACKBQTVXSWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTWKBXAS2.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/6470/review/3389899053</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/6470#pullrequestreview-3389899053",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/6470#pullrequestreview-3389899053",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>