Class: GeojsonDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/geojson-diff.rb,
lib/geojson-diff/version.rb,
lib/geojson-diff/property-diff.rb

Defined Under Namespace

Classes: PropertyDiff

Constant Summary collapse

META_KEY =
'_geojson_diff'
VERSION =
'0.0.1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(before, after) ⇒ GeojsonDiff

Returns a new instance of GeojsonDiff.



15
16
17
18
# File 'lib/geojson-diff.rb', line 15

def initialize(before, after)
  @before = ensure_feature_collection(RGeo::GeoJSON.decode(before, :json_parser => :json))
  @after = ensure_feature_collection(RGeo::GeoJSON.decode(after, :json_parser => :json))
end

Instance Attribute Details

#afterObject

Returns the value of attribute after.



20
21
22
# File 'lib/geojson-diff.rb', line 20

def after
  @after
end

#beforeObject

Returns the value of attribute before.



20
21
22
# File 'lib/geojson-diff.rb', line 20

def before
  @before
end

Instance Method Details

#addedObject



22
23
24
# File 'lib/geojson-diff.rb', line 22

def added
  diff(@after,@before,"added")
end

#removedObject



26
27
28
# File 'lib/geojson-diff.rb', line 26

def removed
  diff(@before,@after,"removed")
end

#unchangedObject



30
31
32
# File 'lib/geojson-diff.rb', line 30

def unchanged
  diff(@before,@after,"unchanged")
end