myimdb 0.4.2 → 0.4.3
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/README.rdoc +4 -2
- data/VERSION +1 -1
- data/lib/myimdb.rb +10 -4
- data/myimdb.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -57,9 +57,11 @@ Utility gem for fetching movie details.
|
|
57
57
|
~/m> myimdb-catalogue the\ dark\ knight/
|
58
58
|
Fetching metadata for: the dark knight
|
59
59
|
Renaming: the dark knight to: the dark knight [2008] [8.9,430594] [Christopher Nolan]
|
60
|
+
~/m> ls
|
61
|
+
the dark knight [2008] [8.9,430594] [Christopher Nolan]
|
60
62
|
|
61
63
|
|
62
|
-
|
64
|
+
=== As a library
|
63
65
|
|
64
66
|
>> require 'myimdb'
|
65
67
|
=> true
|
@@ -74,7 +76,7 @@ Utility gem for fetching movie details.
|
|
74
76
|
>> site.release_date.to_s
|
75
77
|
=> "2008-07-18"
|
76
78
|
|
77
|
-
or
|
79
|
+
==== or
|
78
80
|
|
79
81
|
>> require 'myimdb'
|
80
82
|
=> true
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/lib/myimdb.rb
CHANGED
@@ -6,9 +6,15 @@ require 'open-uri'
|
|
6
6
|
require 'myimdb/search'
|
7
7
|
require 'myimdb/scraper'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
['Imdb', 'RottenTomatoes', 'Metacritic', 'Freebase'].each do |site|
|
10
|
+
klass = Object.const_set("#{site}Movie", Class.new)
|
11
|
+
klass.class_eval do
|
12
|
+
class << self
|
13
|
+
define_method :search do |movie_name|
|
14
|
+
site = self.to_s.gsub('Movie', '')
|
15
|
+
search_result = Myimdb::Search::Base.search(movie_name, :restrict_to=> "#{site.downcase}.com")[0]
|
16
|
+
eval("Myimdb::Scraper::#{site}").new(search_result[:url]) if search_result
|
17
|
+
end
|
18
|
+
end
|
13
19
|
end
|
14
20
|
end
|
data/myimdb.gemspec
CHANGED