random_images 0.0.1 → 0.0.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,5 +1,6 @@
1
1
  require 'open-uri'
2
2
  require 'nokogiri'
3
+ require 'cgi'
3
4
 
4
5
  module RandomImages
5
6
 
@@ -10,7 +11,7 @@ module RandomImages
10
11
  nokogiri = (1..max).map{ Nokogiri::HTML(open_page(keyword, content)) }
11
12
  nokogiri.map do |n|
12
13
  n.search("a img").map{ |x| x["src"].split(":http://")[1] }.compact.map(&:to_url)
13
- end.flatten[0, number]
14
+ end.flatten[0, number].amp(&:unescape)
14
15
  end
15
16
 
16
17
  private
@@ -56,4 +57,8 @@ class String
56
57
  def to_url
57
58
  "http://" + self
58
59
  end
60
+
61
+ def unescape
62
+ CGI.unescape(self)
63
+ end
59
64
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{random_images}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jordi Noguera"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random_images
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jordi Noguera