Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

custom reader options for attributes module, so one can use a private…

… reader instead of the global Schema::Reader
  • Loading branch information...
commit 5f5ad191ae3d5a997073c6065220af0f0f0f1421 1 parent 6c42fdf
@schorsch schorsch authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/schema_tools/modules/attributes.rb
View
4 lib/schema_tools/modules/attributes.rb
@@ -15,8 +15,10 @@ module ClassMethods
# @param [Symbol|String] schema name
# @param [Hash<Symbol|String>] opts
# @options opts [String] :path schema path
+ # @options opts [SchemaTools::Reader] :reader instance, instead of global reader/registry
def has_schema_attrs(schema, opts={})
- schema = SchemaTools::Reader.read(schema, opts[:path])
+ reader = opts[:reader] || SchemaTools::Reader
+ schema = reader.read(schema, opts[:path])
# make getter / setter
schema[:properties].each do |key, val|
# getter
Please sign in to comment.
Something went wrong with that request. Please try again.