Soleone-gamefaqs 0.0.3 → 0.0.4
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.textile +18 -0
- data/lib/gamefaqs/search.rb +4 -6
- metadata +1 -1
data/README.textile
CHANGED
@@ -57,6 +57,24 @@ h3. Reviews
|
|
57
57
|
</code>
|
58
58
|
</pre>
|
59
59
|
|
60
|
+
h3. Examples for quick random quotes
|
61
|
+
|
62
|
+
<pre>
|
63
|
+
<code>
|
64
|
+
include GameFaqs
|
65
|
+
|
66
|
+
# The title of a random review for Super Mario Land
|
67
|
+
Random.review("super mario land", "game boy").title
|
68
|
+
|
69
|
+
Random.one_line_review("super mario land", "game boy")
|
70
|
+
# => "Not Nintendo's (or my) best, but still a decent effort." - 6/10
|
71
|
+
|
72
|
+
Random.one_line_review("super mario land", "game boy", :detailed => true)
|
73
|
+
# => "Super Mario Land [Game Boy]: Not Nintendo's (or my) best, but still a decent effort." - 6/10
|
74
|
+
</code>
|
75
|
+
</pre>
|
76
|
+
|
77
|
+
|
60
78
|
h2. Requirements
|
61
79
|
|
62
80
|
*Hpricot* (will be installed automatically by RubyGems as a dependency)
|
data/lib/gamefaqs/search.rb
CHANGED
@@ -44,14 +44,12 @@ module GameFaqs
|
|
44
44
|
# get by full name (case insensitive)
|
45
45
|
names = List.platforms.select { |p| p.name.downcase == platform_name.downcase }
|
46
46
|
# find other similar if not found exactly one before
|
47
|
-
names = List.platforms.select{|p| p.name
|
47
|
+
names = List.platforms.select{|p| p.name =~ /#{platform_name.split(' ').join('.*')}/i} if names.size != 1
|
48
48
|
# if still nothing it is probably if you searched for "n64".
|
49
49
|
if names.size != 1
|
50
|
-
|
51
|
-
platform_name.each_byte
|
52
|
-
|
53
|
-
end
|
54
|
-
names = List.platforms.select{ |p| p.name.downcase =~ Regexp.compile(platform) }
|
50
|
+
platform_regexp = ""
|
51
|
+
platform_name.each_byte { |byte| platform_regexp << byte.chr << ".*" }
|
52
|
+
names = List.platforms.select{ |p| p.name =~ /#{platform_regexp}/i }
|
55
53
|
end
|
56
54
|
|
57
55
|
case names.size
|