twofishes 2.1.0.pre.rc.1 → 2.1.0.pre.rc.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60346193a88118337642826f79fb68b87373fda3
4
- data.tar.gz: 1ca46ac922435ce41af3d5e46725689acf20ddc2
3
+ metadata.gz: 4c736e4fa16a0dd414258b492bf9e28216159529
4
+ data.tar.gz: 51098838583a9781a6e8993008ae11051cf49ec1
5
5
  SHA512:
6
- metadata.gz: 74f76b892901bfb33ec5aa15cb913a74c28216a70d922647bc0793bd922d00864a8f07d6fe1d470ba6cc2a99316b14e1aed3af482929fdad79e541e09e62638e
7
- data.tar.gz: 1ffe49e7909c92ee1bb6a7a2735973b86363444598d6075c61fae209d582179a8817825f130cdad180f9abe23a41540e77e6374cb506cbff2028359baf730e9e
6
+ metadata.gz: 372613ddb1f2c0aa1c7a475fdf4179a5b36bd309ce55b456110625a367e3ed4517328913e21be545870c80caa8c17470ad0cc0cd328539b7512c6c38f62a5a7d
7
+ data.tar.gz: e9c771da55db7ae6ded344382a4289243316357d68f608a6bc8c19f7b9e8a33f1eef0f19ec1088882b223bc7ee23425604f0aa78add64bcef64477bf00bbab7d
@@ -13,11 +13,11 @@ module Twofishes
13
13
  case ll
14
14
  when String
15
15
  lat, lng = ll.split(/\s*,\s*/)
16
- GeocodePoint.new(lat: lat.to_f, lng: lng.to_f)
16
+ new_point(lat, lng)
17
17
  when Array
18
- GeocodePoint.new(lat: ll[0].to_f, lng: ll[1].to_f)
18
+ new_point(ll[0], ll[1])
19
19
  when Hash
20
- GeocodePoint.new(lat: ll[:lat].to_f, lng: ll[:lng].to_f)
20
+ new_point(ll[:lat], ll[:lng])
21
21
  else
22
22
  ll
23
23
  end
@@ -27,42 +27,37 @@ module Twofishes
27
27
  case bounds
28
28
  when String
29
29
  ne_lat, ne_lng, sw_lat, sw_lng = bounds.split(/\s*,\s*/)
30
- ne = GeocodePoint.new(lat: ne_lat.to_f, lng: ne_lng.to_f)
31
- sw = GeocodePoint.new(lat: sw_lat.to_f, lng: sw_lng.to_f)
32
- GeocodeBoundingBox.new(ne: ne, sw: sw)
30
+ new_bounding_box(ne_lat, ne_lng, sw_lat, sw_lng)
33
31
  when Array
34
- ne = GeocodePoint.new(lat: bounds[0].to_f, lng: bounds[1].to_f)
35
- sw = GeocodePoint.new(lat: bounds[2].to_f, lng: bounds[3].to_f)
36
- GeocodeBoundingBox.new(ne: ne, sw: sw)
32
+ new_bounding_box(bounds[0], bounds[1], bounds[2], bounds[3])
37
33
  when Hash
38
- ne = GeocodePoint.new(lat: bounds[:ne_lat].to_f, lng: bounds[:ne_lng].to_f)
39
- sw = GeocodePoint.new(lat: bounds[:sw_lat].to_f, lng: bounds[:sw_lng].to_f)
40
- GeocodeBoundingBox.new(ne: ne, sw: sw)
34
+ new_bounding_box(bounds[:ne_lat], bounds[:ne_lng], bounds[:sw_lat], bounds[:sw_lng])
41
35
  else
42
36
  bounds
43
37
  end
44
38
  end
45
39
 
46
40
  def substitute_aliases(options)
47
- options = options.dup
41
+ options = Hash[options.map{|k,v| [k.to_s.camelize(:lower).to_sym,v] } ]
48
42
 
49
- options[:maxInterpretations] ||= options.delete(:max_interpretations) || options.delete(:max)
50
- options[:allowedSources] ||= options.delete(:allowed_sources) || options.delete(:sources)
51
- options[:responseIncludes] ||= options.delete(:response_includes) || options.delete(:includes)
52
- options[:woeHint] ||= options.delete(:woe_hint)
53
- options[:woeRestrict] ||= options.delete(:woe_restrict)
54
- options[:autocompleteBias] ||= options.delete(:autocomplete_bias) || options.delete(:bias)
43
+ options[:maxInterpretations] ||= options.delete(:max)
44
+ options[:allowedSources] ||= options.delete(:sources)
45
+ options[:responseIncludes] ||= options.delete(:includes)
46
+ options[:autocompleteBias] ||= options.delete(:bias)
55
47
 
56
- if options[:ll].kind_of? Hash
57
- options[:ll][:lng] = options[:ll][:lon] if options[:ll][:lon]
58
- end
48
+ options
49
+ end
59
50
 
60
- if options[:bounds].kind_of? Hash
61
- options[:bounds][:ne_lng] = options[:bounds][:ne_lon] if options[:bounds] and options[:bounds][:ne_lon]
62
- options[:bounds][:sw_lng] = options[:bounds][:sw_lon] if options[:bounds] and options[:bounds][:sw_lon]
63
- end
51
+ private
64
52
 
65
- options
53
+ def new_bounding_box(ne_lat, ne_lng, sw_lat, sw_lng)
54
+ ne = GeocodePoint.new(lat: ne_lat.to_f, lng: ne_lng.to_f)
55
+ sw = GeocodePoint.new(lat: sw_lat.to_f, lng: sw_lng.to_f)
56
+ GeocodeBoundingBox.new(ne: ne, sw: sw)
57
+ end
58
+
59
+ def new_point(lat, lng)
60
+ GeocodePoint.new(lat: lat.to_f, lng: lng.to_f)
66
61
  end
67
62
  end
68
63
  end
@@ -1,3 +1,3 @@
1
1
  module Twofishes
2
- VERSION = "2.1.0.pre.rc.1"
2
+ VERSION = "2.1.0.pre.rc.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twofishes
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.pre.rc.1
4
+ version: 2.1.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Felder