kinja 0.0.11 → 0.0.12
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.
- checksums.yaml +4 -4
- data/lib/kinja/helpers.rb +1 -1
- data/lib/kinja/version.rb +1 -1
- data/spec/lib/kinja/helpers_spec.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 929cb0064bc7276263dfb0e6335f75e9013083cc
|
4
|
+
data.tar.gz: e52dce87590a124bdf44daba31d56d76a8b69299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 941b4fa7229db1b53bd6893a279f87bac1976d5f8f90e42f292020151f94e77be061bdeec3e27db8ebc3725969eb4f0d4350def1708a6a34fa973ef1d15f8f66
|
7
|
+
data.tar.gz: 4033b706869fb16c72e4be6d0b249737fe4a8ea4a4612527c9fbd541c41381cf1ea5ba530a0492b517878c594fdca89644c625ff689cb875bd02a22c7c26ee0f
|
data/lib/kinja/helpers.rb
CHANGED
@@ -2,7 +2,7 @@ module Kinja
|
|
2
2
|
module Helper
|
3
3
|
def get_post_id(link)
|
4
4
|
return link if link.match(/^\d+$/)
|
5
|
-
new_link_re =
|
5
|
+
new_link_re = /-?(\d{8,11})\/?/
|
6
6
|
old_link_re = /\.com\/(\d+)\//
|
7
7
|
return link.match(new_link_re)[1] if link.match(new_link_re)
|
8
8
|
return link.match(old_link_re)[1] if link.match(old_link_re)
|
data/lib/kinja/version.rb
CHANGED
@@ -17,6 +17,9 @@ describe Kinja do
|
|
17
17
|
|
18
18
|
multi_nums = "http://theconcourse.deadspin.com/a-21st-century-rip-van-winkle-what-changed-in-my-decad-1691783386/+laceydonohue"
|
19
19
|
expect(kinja.get_post_id multi_nums).to eq "1691783386"
|
20
|
+
|
21
|
+
kotaku_bum = "http://kotaku.com/1710975351"
|
22
|
+
expect(kinja.get_post_id kotaku_bum).to eq "1710975351"
|
20
23
|
end
|
21
24
|
|
22
25
|
it "returns the id if it's passed an id instead of a link" do
|