metainspector 4.0.0.rc1 → 4.0.0.rc2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ba263e5a232d332082575e310c75d31c971a419
|
4
|
+
data.tar.gz: befb5ddec99b4b36db95e37eb2ab33e22bfd1e2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d813747e71e15d058104398fcc53eefd8aeeee2c2eb224b53cb0d2dcf6bf786c1bcd3de9111152d7e583e6fd96a42b4b34fa34e4bfb53cf4b7fc8127e27dc01
|
7
|
+
data.tar.gz: fe41a9cb0a176c9d03892ab18d48194203d12aeb2df22faf47c6a2d32d91fa0422aabb5acd7c12e0b3f9a336898ca888601a5ebe1dae36a0de1a790d5bc60d51
|
@@ -23,7 +23,7 @@ module MetaInspector
|
|
23
23
|
def_delegators :@document, :url, :scheme, :host
|
24
24
|
def_delegators :@meta_tag_parser, :meta_tags, :meta_tag, :meta, :charset
|
25
25
|
def_delegators :@links_parser, :links, :feed, :base_url
|
26
|
-
def_delegators :@images_parser, :images
|
26
|
+
def_delegators :@images_parser, :images
|
27
27
|
def_delegators :@texts_parser, :title, :description
|
28
28
|
|
29
29
|
# Returns the whole parsed document
|
@@ -2,7 +2,7 @@ module MetaInspector
|
|
2
2
|
module Parsers
|
3
3
|
class ImagesParser < Base
|
4
4
|
def_delegators :@main_parser, :parsed, :meta, :base_url
|
5
|
-
def_delegators :images_collection, :length, :size
|
5
|
+
def_delegators :images_collection, :each, :length, :size, :last, :[]
|
6
6
|
|
7
7
|
include Enumerable
|
8
8
|
|
@@ -10,10 +10,6 @@ module MetaInspector
|
|
10
10
|
self
|
11
11
|
end
|
12
12
|
|
13
|
-
def each(&block)
|
14
|
-
images_collection.each(&block)
|
15
|
-
end
|
16
|
-
|
17
13
|
# Returns the parsed image from Facebook's open graph property tags
|
18
14
|
# Most all major websites now define this property and is usually very relevant
|
19
15
|
# See doc at http://developers.facebook.com/docs/opengraph/
|
@@ -6,21 +6,21 @@ describe MetaInspector do
|
|
6
6
|
describe "returns an Enumerable" do
|
7
7
|
let(:page) { MetaInspector.new('https://twitter.com/markupvalidator') }
|
8
8
|
|
9
|
-
it "
|
9
|
+
it "responds to #length" do
|
10
10
|
page.images.length.should == 6
|
11
11
|
end
|
12
12
|
|
13
|
-
it "
|
13
|
+
it "responds to #size" do
|
14
14
|
page.images.size.should == 6
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "responds to #each" do
|
18
18
|
c = []
|
19
19
|
page.images.each {|i| c << i}
|
20
20
|
c.length.should == 6
|
21
21
|
end
|
22
22
|
|
23
|
-
it "
|
23
|
+
it "responds to #sort" do
|
24
24
|
page.images.sort
|
25
25
|
.should == ["https://si0.twimg.com/sticky/default_profile_images/default_profile_6_mini.png",
|
26
26
|
"https://twimg0-a.akamaihd.net/a/1342841381/images/bigger_spinner.gif",
|
@@ -29,6 +29,19 @@ describe MetaInspector do
|
|
29
29
|
"https://twimg0-a.akamaihd.net/profile_images/2380086215/fcu46ozay5f5al9kdfvq_normal.png",
|
30
30
|
"https://twimg0-a.akamaihd.net/profile_images/2380086215/fcu46ozay5f5al9kdfvq_reasonably_small.png"]
|
31
31
|
end
|
32
|
+
|
33
|
+
it "responds to #first" do
|
34
|
+
page.images.first.should == "https://twimg0-a.akamaihd.net/profile_images/2380086215/fcu46ozay5f5al9kdfvq_reasonably_small.png"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "responds to #last" do
|
38
|
+
page.images.last.should == "https://twimg0-a.akamaihd.net/a/1342841381/images/bigger_spinner.gif"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "responds to #[]" do
|
42
|
+
page.images[0].should == "https://twimg0-a.akamaihd.net/profile_images/2380086215/fcu46ozay5f5al9kdfvq_reasonably_small.png"
|
43
|
+
end
|
44
|
+
|
32
45
|
end
|
33
46
|
|
34
47
|
it "should find all page images" do
|