Hyrule-Compendium 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyrule_compendium.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b2d9bbbe32c561ccf1c94fd12ade17722d271a33099bddd1a12fa322a4cd571
|
4
|
+
data.tar.gz: 2e5cee56a637f9cd13683f71d2d879809d64b67c57f44a0e8670153c10c45b21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d95e42274481077bf1ca024d7b309b7a3a1898111fdf456504c3bf0673afc9169bde5fe8602d3208fde48d028772a8bb8bbe1320545c0c8a99456dd01425a0
|
7
|
+
data.tar.gz: e507fb881f8edda640373e5eaf41af0d0eaf926bb3c0d3e33d1450e02e5f90417c10f26ba66b29abfeb53edacdd82d1154eea71e6831d93d8c896788f9d1913f
|
data/lib/hyrule_compendium.rb
CHANGED
@@ -119,7 +119,7 @@ class Hyrule_Compendium
|
|
119
119
|
return make_req @base, timeout
|
120
120
|
end
|
121
121
|
|
122
|
-
def download_entry_image entry, output_file, timeout=@default_timeout
|
122
|
+
def download_entry_image entry, output_file=nil, timeout=@default_timeout
|
123
123
|
# Downloads the image of a compendium entry.
|
124
124
|
#
|
125
125
|
# Parameters:
|
@@ -127,12 +127,14 @@ class Hyrule_Compendium
|
|
127
127
|
# - type: str, int
|
128
128
|
# * `output_file`: The output file's path.
|
129
129
|
# - type: str
|
130
|
+
# - default: entry's name with a ".png" extension with spaces replaced with underscores
|
130
131
|
# * `timeout`: Seconds to wait for server response until raising `Net::ReadTimeout`.
|
131
132
|
# - type: float, int
|
132
133
|
# - default: `@default_timeout`
|
133
134
|
|
134
|
-
|
135
|
-
|
135
|
+
entry_data = get_entry entry, timeout
|
136
|
+
open entry_data["image"] do |image|
|
137
|
+
File.open output_file || (entry_data["name"] + ".png").gsub(" ", "_"), "wb" do |file|
|
136
138
|
file.write image.read
|
137
139
|
end
|
138
140
|
end
|