lib/inat/data/ddl.rb in inat-get-0.8.0.12 vs lib/inat/data/ddl.rb in inat-get-0.8.0.13
- old
+ new
@@ -1,17 +1,36 @@
# frozen_string_literal: true
-module DDL
+# TODO: подумать и заменить константой, возможно
+class INat::Data::DDL
+
+ def initialize
+ @models = []
+ end
+
+ def <<(model)
+ @models << model
+ end
+
+ def DDL
+ @models.map(&:DDL).join("\n")
+ end
+
class << self
- def << model
- @models ||= []
- @models << model
+ private :new
+
+ def instance
+ @instance ||= new
end
+ def <<(model)
+ instance << model
+ end
+
def DDL
- @models.map(&:DDL).join("\n")
+ instance.DDL
end
end
end