]> git.openstreetmap.org Git - rails.git/blobdiff - lib/osm_community_index/resource_backend.rb
Switch to using FrozenRecord for loading communities
[rails.git] / lib / osm_community_index / resource_backend.rb
diff --git a/lib/osm_community_index/resource_backend.rb b/lib/osm_community_index/resource_backend.rb
new file mode 100644 (file)
index 0000000..e16d951
--- /dev/null
@@ -0,0 +1,14 @@
+# A backend for FrozenRecord
+
+module OsmCommunityIndex
+  module ResourceBackend
+    def self.filename(_model)
+      "resources.json"
+    end
+
+    def self.load(file_path)
+      resources = JSON.parse(File.read(file_path))
+      resources["resources"].values
+    end
+  end
+end