Skip to content
Browse files

use class builder from json_schema_tools

  • Loading branch information...
1 parent 8df47cc commit 8931e92e7dd96367bbea3654d69517b9921024cf @schorsch schorsch committed
Showing with 5 additions and 11 deletions.
  1. +4 −10 lib/doc_tag.rb
  2. +1 −1 lib/doc_tag/version.rb
View
14 lib/doc_tag.rb
@@ -1,20 +1,14 @@
require 'json_schema_tools'
require 'doctag_json_schema'
+
module DocTag
class << self
# initialize class structure from json schema
def init
- # TODO use upcoming ClassFactory from schema_tools
reader = SchemaTools::Reader.new
- reader.read_all(DocTag::Schema.path).each do |schema|
- class_name = schema['name'].classify
- next if DocTag.const_defined?(class_name)
- klass = DocTag.const_set(class_name,Class.new)
- klass.class_eval do
- include SchemaTools::Modules::Attributes
- has_schema_attrs schema['name'], reader: reader
- end
- end
+ SchemaTools::KlassFactory.build namespace: DocTag,
+ reader: reader,
+ path: DocTag::Schema.path
end
end
end
View
2 lib/doc_tag/version.rb
@@ -1,3 +1,3 @@
module DocTag
- VERSION = '0.0.1'
+ VERSION = '0.0.2'
end

0 comments on commit 8931e92

Please sign in to comment.
Something went wrong with that request. Please try again.