geo_units 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/geo_units.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{geo_units}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Kristian Mandrup}]
12
- s.date = %q{2011-06-13}
12
+ s.date = %q{2011-06-19}
13
13
  s.description = %q{Easily convert between different distance units such as kms, miles etc.}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/geo_units/numeric_ext.rb",
33
33
  "spec/geo_units/converter_spec.rb",
34
34
  "spec/geo_units/dms_converter_spec.rb",
35
+ "spec/geo_units/numeric_ext_spec.rb",
35
36
  "spec/spec_helper.rb"
36
37
  ]
37
38
  s.homepage = %q{http://github.com/kristianmandrup/geo_units}
@@ -11,3 +11,11 @@ class String
11
11
  GeoUnits::DmsConverter.parse_dms self
12
12
  end
13
13
  end
14
+
15
+ class Array
16
+ def to_dms
17
+ lat = self.respond_to?(:to_lat) ? self.to_lat : self[0]
18
+ lng = self.respond_to?(:to_lng) ? self.to_lng : self[1]
19
+ [lat.to_lat_dms, lng.to_lng_dms].join(', ')
20
+ end
21
+ end
@@ -14,7 +14,7 @@ module GeoUnits
14
14
 
15
15
 
16
16
  def to_dms format = :dms, dp = nil
17
- GeoCalc::DmsConverter.to_dms self, format, dp
17
+ GeoUnits::DmsConverter.to_dms self, format, dp
18
18
  end
19
19
 
20
20
  def to_lat_dms format = :dms, dp = nil
@@ -24,6 +24,7 @@ module GeoUnits
24
24
  def to_lon_dms format = :dms, dp = nil
25
25
  GeoUnits::Converter.to_lon self, format, dp
26
26
  end
27
+ alias_method :to_lng_dms, :to_lon_dms
27
28
 
28
29
  # Converts numeric degrees to radians
29
30
  def to_rad
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ # - www.movable-type.co.uk/scripts/latlong.html
4
+ describe Array do
5
+ # deg, format, dp
6
+ describe '#to_dms' do
7
+ it 'should convert [58.3, 4] to string of dms format' do
8
+ dms_arr = [58.3, 4].to_dms
9
+ puts dms_arr.inspect
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo_units
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-13 00:00:00.000000000Z
12
+ date: 2011-06-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sugar-high
16
- requirement: &2154936400 !ruby/object:Gem::Requirement
16
+ requirement: &2157728000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.4.6.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154936400
24
+ version_requirements: *2157728000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2154935800 !ruby/object:Gem::Requirement
27
+ requirement: &2157727160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.5.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2154935800
35
+ version_requirements: *2157727160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &2154935220 !ruby/object:Gem::Requirement
38
+ requirement: &2157726400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.6
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2154935220
46
+ version_requirements: *2157726400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &2154934640 !ruby/object:Gem::Requirement
49
+ requirement: &2157725640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2154934640
57
+ version_requirements: *2157725640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &2154934040 !ruby/object:Gem::Requirement
60
+ requirement: &2157724940 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2154934040
68
+ version_requirements: *2157724940
69
69
  description: Easily convert between different distance units such as kms, miles etc.
70
70
  email: kmandrup@gmail.com
71
71
  executables: []
@@ -89,6 +89,7 @@ files:
89
89
  - lib/geo_units/numeric_ext.rb
90
90
  - spec/geo_units/converter_spec.rb
91
91
  - spec/geo_units/dms_converter_spec.rb
92
+ - spec/geo_units/numeric_ext_spec.rb
92
93
  - spec/spec_helper.rb
93
94
  homepage: http://github.com/kristianmandrup/geo_units
94
95
  licenses:
@@ -105,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
106
  version: '0'
106
107
  segments:
107
108
  - 0
108
- hash: 2458043336653105499
109
+ hash: 1770670745232636098
109
110
  required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  none: false
111
112
  requirements: