lib/avro/builder/dsl.rb in avro-builder-0.14.1 vs lib/avro/builder/dsl.rb in avro-builder-0.15.0.rc0
- old
+ new
@@ -36,10 +36,14 @@
else
instance_eval(&block)
end
end
+ def abstract?
+ @last_object && @last_object.abstract?
+ end
+
# Define an Avro schema record
def record(name = nil, options = {}, &block)
create_named_type(name, :record, options, &block)
end
@@ -90,10 +94,13 @@
end
def type_macro(name, type_object, options = {})
raise "#{type_object.inspect} must be a type object" unless type_object.is_a?(Types::Type)
raise "namespace cannot be included in name: #{name}" if name.to_s.index('.')
- cache.add_type_by_name(type_object, name, options[:namespace] || namespace)
+ type_clone = type_object.clone
+ type_clone.send(:abstract=, true)
+ cache.add_type_by_name(type_clone, name, options[:namespace] || namespace)
+ @last_object = type_clone
end
private
def cache