silva 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/silva/system.rb +23 -0
- data/lib/silva/version.rb +1 -1
- data/silva.gemspec +1 -0
- metadata +19 -2
data/lib/silva/system.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'silva/system/en'
|
2
|
+
require 'silva/system/osgb36'
|
3
|
+
require 'silva/system/gridref'
|
4
|
+
require 'silva/system/wgs84'
|
5
|
+
|
6
|
+
module Silva
|
7
|
+
##
|
8
|
+
# A location system -- :wgs84, :osgb36, :en or :gridref.
|
9
|
+
module System
|
10
|
+
##
|
11
|
+
# A factory method to simplify and moderate creation of location systems.
|
12
|
+
# @param [Symbol] system_name The name of the system to be created.
|
13
|
+
# @param [Hash] options Parameters relevant to the given system.
|
14
|
+
# @return [Silva::System] A valid location system.
|
15
|
+
# @raises Silva::InvalidSystemError If the given system can't be created.
|
16
|
+
def self.create(system_name, options)
|
17
|
+
system = Silva::System.const_get(system_name.to_s.capitalize)
|
18
|
+
system.new(options)
|
19
|
+
rescue NameError
|
20
|
+
raise Silva::InvalidSystemError, "Can't create system: #{system_name}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/silva/version.rb
CHANGED
data/silva.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: silva
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
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: 2013-08-
|
12
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: pry
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
description: Convert between the GPS (WGS84) location standard and UK Ordnance Survey
|
63
79
|
standards
|
64
80
|
email:
|
@@ -74,6 +90,7 @@ files:
|
|
74
90
|
- Rakefile
|
75
91
|
- lib/silva.rb
|
76
92
|
- lib/silva/location.rb
|
93
|
+
- lib/silva/system.rb
|
77
94
|
- lib/silva/system/base.rb
|
78
95
|
- lib/silva/system/co_ordinate.rb
|
79
96
|
- lib/silva/system/en.rb
|