yahoo_weatherman 0.8 → 0.9
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/lib/yahoo_weatherman/response.rb +13 -16
- data/lib/yahoo_weatherman.rb +1 -1
- data/yahoo_weatherman.gemspec +1 -1
- metadata +3 -3
@@ -186,35 +186,32 @@ module Weatherman
|
|
186
186
|
|
187
187
|
def translate!(attributes)
|
188
188
|
if i18n?
|
189
|
-
translate_days! attributes
|
190
189
|
translate_text! attributes
|
190
|
+
translate_days! attributes
|
191
191
|
translate_locations! attributes
|
192
192
|
end
|
193
193
|
attributes
|
194
194
|
end
|
195
195
|
|
196
196
|
def translate_text!(attributes)
|
197
|
-
|
198
|
-
attributes['text'] = language_translations[attributes['code']]
|
199
|
-
end
|
197
|
+
translate_attribute('text', attributes, language_translations, 'code')
|
200
198
|
end
|
201
199
|
|
202
|
-
def
|
203
|
-
|
204
|
-
|
205
|
-
%w(city country region).each do |key|
|
206
|
-
next unless attributes.key? key
|
200
|
+
def translate_days!(attributes)
|
201
|
+
translate_attribute('day', attributes, language_translations['forecasts']['days'])
|
202
|
+
end
|
207
203
|
|
208
|
-
|
209
|
-
|
210
|
-
|
204
|
+
def translate_locations!(attributes)
|
205
|
+
(%w[city country region] & attributes.keys).each do |key|
|
206
|
+
translate_attribute(key, attributes, language_translations['locations'])
|
211
207
|
end
|
212
208
|
end
|
213
209
|
|
214
|
-
def
|
215
|
-
|
216
|
-
|
217
|
-
|
210
|
+
def translate_attribute(name, attributes, translations, change_by = nil)
|
211
|
+
translation_key = attributes[(change_by || name)]
|
212
|
+
|
213
|
+
if attributes[name] and translations[translation_key]
|
214
|
+
attributes[name] = translations[translation_key]
|
218
215
|
end
|
219
216
|
end
|
220
217
|
|
data/lib/yahoo_weatherman.rb
CHANGED
data/yahoo_weatherman.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "yahoo_weatherman"
|
3
|
-
gem.version = "0.
|
3
|
+
gem.version = "0.9"
|
4
4
|
gem.authors = ["Dalto Curvelano Junior"]
|
5
5
|
gem.description = "A ruby wrapper to the Yahoo! Weather feed with i18n support."
|
6
6
|
gem.summary = "A ruby wrapper to the Yahoo! Weather feed with i18n support."
|
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
version: "0.
|
7
|
+
- 9
|
8
|
+
version: "0.9"
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Dalto Curvelano Junior
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2010-04-
|
16
|
+
date: 2010-04-28 00:00:00 -03:00
|
17
17
|
default_executable:
|
18
18
|
dependencies: []
|
19
19
|
|