lib/inch/code_object/provider/yard/parser.rb in inch-0.3.1 vs lib/inch/code_object/provider/yard/parser.rb in inch-0.3.2.rc1

- old
+ new

@@ -2,13 +2,10 @@ module CodeObject module Provider module YARD # Parses the source tree (using YARD) class Parser - DEFAULT_PATHS = ["app/**/*.rb", "lib/**/*.rb"] - DEFAULT_EXCLUDED = [] - IGNORE_TYPES = [:macro] # Helper method to parse an instance with the given +args+ # # @see #parse @@ -17,28 +14,32 @@ parser = self.new parser.parse(*args) parser end - def parse(dir, paths, excluded) + # @param dir [String] directory + # @param config [Inch::Config::Codebase] configuration for codebase + # @return [void] + def parse(dir, config) old_dir = Dir.pwd Dir.chdir dir - parse_yard_objects(paths, excluded) + parse_yard_objects(config.included_files, config.excluded_files) inject_base_dir(dir) Dir.chdir old_dir end + # @return [Array<YARD::Object::Base>] def objects @objects ||= parsed_objects.map do |o| YARD::Object.for(o) unless IGNORE_TYPES.include?(o.type) end.compact end private def parse_yard_objects(paths, excluded) ::YARD::Registry.clear - ::YARD.parse(paths || DEFAULT_PATHS, excluded || DEFAULT_EXCLUDED) + ::YARD.parse(paths, excluded) end def inject_base_dir(dir) objects.each do |object| object.base_dir = dir