lib/schematic/generator/sandbox.rb in schematic-0.5.4 vs lib/schematic/generator/sandbox.rb in schematic-0.5.5
- old
+ new
@@ -3,11 +3,11 @@
class Sandbox
attr_accessor :ignored_elements, :added_elements, :required_elements
def initialize(klass)
@klass = klass
- @ignored_elements ||= []
+ @ignored_elements ||= Hash.new([])
@added_elements ||= {}
@required_elements ||= []
end
def run(&block)
@@ -31,10 +31,16 @@
xsd_generator.options = options
xsd_generator.generate(builder, klass, include_collection)
end
def ignore(*fields)
- fields.each { |field| ignored_elements << field }
+ if fields[0].is_a?(Hash)
+ fields[0].each do |key, value|
+ ignored_elements[key.to_sym] = value
+ end
+ else
+ fields.each { |field| ignored_elements[field] = nil }
+ end
end
def add(*args)
name = args.shift
if name.is_a? Hash