diff --git a/lib/jsduck/batch_processor.rb b/lib/jsduck/batch_processor.rb index beaf2418546ddf4d017cacaf978e814f1ef6b439..6ae1653696862db4d3b76a78991a39be2614b7c2 100644 --- a/lib/jsduck/batch_processor.rb +++ b/lib/jsduck/batch_processor.rb @@ -50,8 +50,7 @@ module JsDuck Process::Accessors.new(classes_hash).process_all! Process::Ext4Events.new(classes_hash, opts).process_all! Process::Enums.new(classes_hash).process_all! - # Ignore override classes after applying them to actual classes - opts.external_classes += Process::Overrides.new(classes_hash).process_all! + Process::Overrides.new(classes_hash, opts).process_all! classes_hash.values end diff --git a/lib/jsduck/options.rb b/lib/jsduck/options.rb index ae8f59c6a0755c84676399b22ab559e8846be1ac..1adf53e832dc40a26955af889b60b8fea04f6630 100644 --- a/lib/jsduck/options.rb +++ b/lib/jsduck/options.rb @@ -142,7 +142,10 @@ module JsDuck # Make options object behave like hash. # This allows us to substitute it with hash in unit tests. def [](key) - send(key) + instance_variable_get("@#{key}") + end + def []=(key, value) + instance_variable_set("@#{key}", value) end def parse!(argv) diff --git a/lib/jsduck/process/overrides.rb b/lib/jsduck/process/overrides.rb index 753a55f293e12d23fb15ceb5d7f6949f077c31f4..6af8ee2f480ecd1e04b3b1033d01ce41491b0bba 100644 --- a/lib/jsduck/process/overrides.rb +++ b/lib/jsduck/process/overrides.rb @@ -4,13 +4,15 @@ module JsDuck module Process class Overrides - def initialize(classes_hash) + def initialize(classes_hash, opts = {:external_classes => []}) @classes_hash = classes_hash + @opts = opts end - # Applies all override classes to target classes, then deletes the - # overrides themselves from classes hash. Returns names of all - # the processed override classes. + # Applies all override classes to target classes, then deletes + # the overrides themselves from classes hash and adds the names + # of all the processed overrides to external_classes list in + # options object. def process_all! overrides = [] @@ -26,7 +28,7 @@ module JsDuck @classes_hash.delete(cls[:name]) end - overrides.map {|c| c[:name] } + @opts[:external_classes] += overrides.map {|c| c[:name] } end private