rgeo-geojson 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.2.3 / 2012-03-17
2
+
3
+ * Returns nil from the encode method if nil is passed in. (Suggestion by Pete Deffendol.)
4
+
1
5
  === 0.2.2 / 2012-01-09
2
6
 
3
7
  * Fixed Feature#property(:symbol). (Reported by Andy Allan.)
data/README.rdoc CHANGED
@@ -38,7 +38,7 @@ Example:
38
38
  RGeo::GeoJSON has the following requirements:
39
39
 
40
40
  * Ruby 1.8.7 or later. Ruby 1.9.2 or later preferred.
41
- * rgeo 0.3.3 or later.
41
+ * rgeo 0.3.7 or later.
42
42
  * If you are using Ruby 1.8, you should install the "json" gem to support
43
43
  parsing JSON strings. Ruby 1.9 has JSON support in its standard library
44
44
  and does not require the gem.
@@ -71,7 +71,7 @@ Contact the author at dazuma at gmail dot com.
71
71
 
72
72
  \RGeo is written by Daniel Azuma (http://www.daniel-azuma.com).
73
73
 
74
- Development of \RGeo is sponsored by GeoPage, Inc. (http://www.geopage.com).
74
+ Development is supported by Pirq. (http://www.pirq.com).
75
75
 
76
76
  === License
77
77
 
data/Version CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -57,16 +57,16 @@ module RGeo
57
57
  #
58
58
  # Options include:
59
59
  #
60
- # <tt>:geo_factory</tt>::
60
+ # [<tt>:geo_factory</tt>]
61
61
  # Specifies the geo factory to use to create geometry objects.
62
62
  # Defaults to the preferred cartesian factory.
63
- # <tt>:entity_factory</tt>::
63
+ # [<tt>:entity_factory</tt>]
64
64
  # Specifies an entity factory, which lets you override the types
65
65
  # of GeoJSON entities that are created. It defaults to the default
66
66
  # RGeo::GeoJSON::EntityFactory, which generates objects of type
67
67
  # RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
68
68
  # See RGeo::GeoJSON::EntityFactory for more information.
69
- # <tt>:json_parser</tt>::
69
+ # [<tt>:json_parser</tt>]
70
70
  # Specifies a JSON parser to use when decoding a String or IO
71
71
  # object. The value may be a Proc object taking the string as the
72
72
  # sole argument and returning the JSON hash, or it may be one of
@@ -145,6 +145,8 @@ module RGeo
145
145
  # will need to JSON-encode it. This is usually accomplished by
146
146
  # calling <tt>to_json</tt> on the hash object, if you have the
147
147
  # appropriate JSON library installed.
148
+ #
149
+ # Returns nil if nil is passed in as the object.
148
150
 
149
151
  def encode(object_)
150
152
  if @entity_factory.is_feature_collection?(object_)
@@ -154,6 +156,8 @@ module RGeo
154
156
  }
155
157
  elsif @entity_factory.is_feature?(object_)
156
158
  _encode_feature(object_)
159
+ elsif object_.nil?
160
+ nil
157
161
  else
158
162
  _encode_geometry(object_)
159
163
  end
@@ -63,16 +63,16 @@ module RGeo
63
63
  #
64
64
  # Options include:
65
65
  #
66
- # <tt>:geo_factory</tt>::
66
+ # [<tt>:geo_factory</tt>]
67
67
  # Specifies the geo factory to use to create geometry objects.
68
68
  # Defaults to the preferred cartesian factory.
69
- # <tt>:entity_factory</tt>::
69
+ # [<tt>:entity_factory</tt>]
70
70
  # Specifies an entity factory, which lets you override the types
71
71
  # of GeoJSON entities that are created. It defaults to the default
72
72
  # RGeo::GeoJSON::EntityFactory, which generates objects of type
73
73
  # RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
74
74
  # See RGeo::GeoJSON::EntityFactory for more information.
75
- # <tt>:json_parser</tt>::
75
+ # [<tt>:json_parser</tt>]
76
76
  # Specifies a JSON parser to use when decoding a String or IO
77
77
  # object. The value may be a Proc object taking the string as the
78
78
  # sole argument and returning the JSON hash, or it may be one of
@@ -96,16 +96,16 @@ module RGeo
96
96
  #
97
97
  # The geo factory is a required argument. Other options include:
98
98
  #
99
- # <tt>:geo_factory</tt>::
99
+ # [<tt>:geo_factory</tt>]
100
100
  # Specifies the geo factory to use to create geometry objects.
101
101
  # Defaults to the preferred cartesian factory.
102
- # <tt>:entity_factory</tt>::
102
+ # [<tt>:entity_factory</tt>]
103
103
  # Specifies an entity factory, which lets you override the types
104
104
  # of GeoJSON entities that are created. It defaults to the default
105
105
  # RGeo::GeoJSON::EntityFactory, which generates objects of type
106
106
  # RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
107
107
  # See RGeo::GeoJSON::EntityFactory for more information.
108
- # <tt>:json_parser</tt>::
108
+ # [<tt>:json_parser</tt>]
109
109
  # Specifies a JSON parser to use when decoding a String or IO
110
110
  # object. The value may be a Proc object taking the string as the
111
111
  # sole argument and returning the JSON hash, or it may be one of
data/test/tc_basic.rb CHANGED
@@ -59,6 +59,12 @@ module RGeo
59
59
  end
60
60
 
61
61
 
62
+ def test_nil
63
+ assert_nil(::RGeo::GeoJSON.encode(nil))
64
+ assert_nil(::RGeo::GeoJSON.decode(nil, :geo_factory => @geo_factory))
65
+ end
66
+
67
+
62
68
  def test_point
63
69
  object_ = @geo_factory.point(10, 20)
64
70
  json_ = {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgeo-geojson
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,19 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-09 00:00:00.000000000 Z
12
+ date: 2012-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rgeo
16
- requirement: &2160272120 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.3.3
21
+ version: 0.3.7
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160272120
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.3.7
25
30
  description: RGeo is a geospatial data library for Ruby. RGeo::GeoJSON is an optional
26
31
  RGeo module providing GeoJSON encoding and decoding services. This module can be
27
32
  used to communicate with location-based web services that understand the GeoJSON
@@ -63,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
68
  version: 1.3.1
64
69
  requirements: []
65
70
  rubyforge_project: virtuoso
66
- rubygems_version: 1.8.12
71
+ rubygems_version: 1.8.19
67
72
  signing_key:
68
73
  specification_version: 3
69
74
  summary: An RGeo module providing GeoJSON encoding and decoding.