geo_units 0.3.1 → 0.3.1.1
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/Rakefile +0 -10
- data/VERSION +1 -1
- data/geo_units.gemspec +1 -1
- data/lib/geo_units/converter/dms.rb +4 -2
- metadata +2 -2
data/Rakefile
CHANGED
@@ -32,13 +32,3 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
32
32
|
end
|
33
33
|
|
34
34
|
task :default => :spec
|
35
|
-
|
36
|
-
require 'rake/rdoctask'
|
37
|
-
Rake::RDocTask.new do |rdoc|
|
38
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
|
-
|
40
|
-
rdoc.rdoc_dir = 'rdoc'
|
41
|
-
rdoc.title = "geo_units #{version}"
|
42
|
-
rdoc.rdoc_files.include('README*')
|
43
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.1
|
1
|
+
0.3.1.1
|
data/geo_units.gemspec
CHANGED
@@ -6,11 +6,13 @@ module GeoUnits
|
|
6
6
|
module Dms
|
7
7
|
include NumericCheckExt
|
8
8
|
|
9
|
+
class ParseError < StandardError; end
|
10
|
+
|
9
11
|
def parse_dms dms_str, options= {}
|
10
12
|
# check for signed decimal degrees without NSEW, if so return it directly
|
11
13
|
return dms_str if is_numeric?(dms_str)
|
12
14
|
|
13
|
-
raise "DMS parse error: #{dms_str}" if !(dms_str =~ /[NSEW]$/) || (dms_str =~ /\./)
|
15
|
+
raise ParseError, "DMS parse error: #{dms_str}" if !(dms_str =~ /[NSEW]$/) || (dms_str =~ /\./)
|
14
16
|
|
15
17
|
# strip off any sign or compass dir'n & split out separate d/m/s
|
16
18
|
dms = dms_str.strip.gsub(/^-/,'').gsub(/[NSEW]$/i,'').split(/[^0-9.,]+/).map(&:strip).map(&:to_f)
|
@@ -32,7 +34,7 @@ module GeoUnits
|
|
32
34
|
nil
|
33
35
|
end
|
34
36
|
|
35
|
-
raise "DMS parse error: #{deg} for #{dms_str}" if !deg
|
37
|
+
raise ParseError, "DMS parse error: #{deg} for #{dms_str}" if !deg
|
36
38
|
|
37
39
|
deg = (deg * -1) if (/^-|[WS]$/i.match(dms_str.strip)) # take '-', west and south as -ve
|
38
40
|
deg.to_f
|
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.3.1
|
4
|
+
version: 0.3.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash:
|
184
|
+
hash: 3331028762583632085
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
none: false
|
187
187
|
requirements:
|