rack-geo 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rack/geo.rb CHANGED
@@ -72,7 +72,7 @@ module Rack
72
72
  end
73
73
 
74
74
  def to_http_header
75
- value = "%f;%f" % [latitude.to_f, longitude.to_f]
75
+ value = "%s;%s" % [latitude.to_f.to_s, longitude.to_f.to_s]
76
76
  value += ";%f" % altitude.to_f if altitude
77
77
  value += " epu=%f" % uncertainty.to_f if uncertainty
78
78
  value += " hdn=%f" % heading.to_f if heading
@@ -3,7 +3,7 @@ module Rack
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  end
@@ -47,8 +47,8 @@ end
47
47
  describe Rack::Geo::Position do
48
48
 
49
49
  ZEROES = %w[0 -0 +0 0.0 -0.0 +0.0]
50
- LATITUDES = %w[-90 -45 0 45 +45 90 +90]
51
- LONGITUDES = %w[-180 -90 -45 0 45 +45 90 +90 180 +180]
50
+ LATITUDES = %w[-90 -45 0 45 +45 90 +90 45.123456789]
51
+ LONGITUDES = %w[-180 -90 -45 0 45 +45 90 +90 180 +180 120.123456789]
52
52
  ALTITUDES = %w[-85.5 -34 0 15 1337 8848 23300.0 +23300.0]
53
53
  UNCERTAINTIES = %w[0 0.0 0.00 1.25 32.1 455 600.123]
54
54
  HEADINGS = %w[0 0.0 0.00 1.25 32.1 180 359.123 360]
@@ -83,7 +83,7 @@ describe Rack::Geo::Position do
83
83
  described_class.from_http_header "TEST"
84
84
  end
85
85
  end
86
-
86
+
87
87
  describe "instance method" do
88
88
  before :each do
89
89
  @instance = described_class.new
@@ -154,6 +154,15 @@ describe Rack::Geo::Position do
154
154
  @instance.latitude.should == latitude_f
155
155
  @instance.longitude.should == longitude_f
156
156
  end
157
+
158
+ it "#to_http_header should not mess up lat/long precision for #{value}" do
159
+ other = described_class.new
160
+
161
+ @instance.parse!(value)
162
+ other.parse!(@instance.to_http_header)
163
+ other.latitude.should == @instance.latitude
164
+ other.longitude.should == @instance.longitude
165
+ end
157
166
  end
158
167
  end
159
168
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-geo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Randy Reddig
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-07-18 00:00:00 -07:00
20
+ date: 2011-03-07 00:00:00 -08:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -79,7 +79,6 @@ extra_rdoc_files:
79
79
  - LICENSE.txt
80
80
  - README.rdoc
81
81
  files:
82
- - .gitignore
83
82
  - HISTORY.rdoc
84
83
  - LICENSE.txt
85
84
  - README.rdoc
@@ -95,8 +94,8 @@ homepage: http://github.com/square/rack-geo
95
94
  licenses: []
96
95
 
97
96
  post_install_message:
98
- rdoc_options:
99
- - --charset=UTF-8
97
+ rdoc_options: []
98
+
100
99
  require_paths:
101
100
  - lib
102
101
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -120,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
119
  requirements: []
121
120
 
122
121
  rubyforge_project:
123
- rubygems_version: 1.3.7
122
+ rubygems_version: 1.4.2
124
123
  signing_key:
125
124
  specification_version: 3
126
125
  summary: Rack middleware for Geo-Position HTTP headers
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- *.gem
2
- *.gemspec
3
- *.log
4
- *.pid
5
- *.sqlite3
6
- *.tmproj
7
- .DS_Store
8
- log/*
9
- pkg/*