Permalink
Browse files

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

… reader instead of the global Schema::Reader
  • Loading branch information...
1 parent 6c42fdf commit 5f5ad191ae3d5a997073c6065220af0f0f0f1421 @schorsch schorsch committed Jan 1, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 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

0 comments on commit 5f5ad19

Please sign in to comment.