lib/rom/schema.rb in rom-3.0.0.rc2 vs lib/rom/schema.rb in rom-3.0.0
- old
+ new
@@ -322,12 +322,10 @@
if missing_attributes.size > 0
raise MissingAttributesError.new(name, missing_attributes)
end
- options[:relations] = @relations = relations
-
block.call if block
count_index
name_index
source_index
@@ -358,9 +356,23 @@
# @api private
def to_input_hash
Types::Coercible::Hash.schema(
map { |attr| [attr.name, attr] }.to_h
)
+ end
+
+ # Return a new schema with new options
+ #
+ # @example
+ # schema.with(inferrer: my_inferrer)
+ #
+ # @param [Hash] new_options
+ #
+ # @return [Schema]
+ #
+ # @api public
+ def with(new_options)
+ self.class.new(name, options.merge(new_options))
end
private
# @api private