]> git.openstreetmap.org Git - rails.git/blobdiff - lib/redactable.rb
Adding first cut of Redactions support
[rails.git] / lib / redactable.rb
diff --git a/lib/redactable.rb b/lib/redactable.rb
new file mode 100644 (file)
index 0000000..b994e85
--- /dev/null
@@ -0,0 +1,15 @@
+require 'osm'
+
+module Redactable
+  def redacted?
+    not self.redaction.nil?
+  end
+
+  def redact!(redaction)
+    # check that this version isn't the current version
+    raise OSM::APICannotRedactError.new if self.is_latest_version?
+
+    # make the change
+    self.redaction = redaction
+  end
+end