geo_hex 3.1.1 → 3.1.2

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.
@@ -1,3 +1,3 @@
1
1
  module GeoHex
2
- VERSION = "3.1.1".freeze
2
+ VERSION = "3.1.2".freeze
3
3
  end
data/lib/geo_hex/zone.rb CHANGED
@@ -59,7 +59,7 @@ module GeoHex
59
59
 
60
60
  # @param [Integer] range the number of zones to search within
61
61
  # @return [Array<GeoHex::Zone>] the neighbouring zones
62
- def neighbours(range)
62
+ def neighbours(range = 1)
63
63
  zones = []
64
64
  x0, xn = x - range, x + range
65
65
 
@@ -72,7 +72,7 @@ module GeoHex
72
72
 
73
73
  x0.upto(xn) do |xi|
74
74
  zones << self.class.new(xi, y+i, level)
75
- zones << self.class.new(xi, y-i, level)
75
+ zones << self.class.new(xi-1, y-i, level)
76
76
  end
77
77
  end
78
78
 
@@ -114,7 +114,7 @@ module GeoHex
114
114
  def encode
115
115
  code, mod_x, mod_y = "", self.x, self.y
116
116
 
117
- (0..level+2).reverse_each do |i|
117
+ (level+2).downto(0) do |i|
118
118
  pow = 3 ** i
119
119
  p2c = (pow / 2.0).ceil
120
120
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo_hex
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-01 00:00:00.000000000 Z
12
+ date: 2012-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake