lib/swaggard.rb in swaggard-0.0.4 vs lib/swaggard.rb in swaggard-0.1.0

- old
+ new

@@ -28,14 +28,18 @@ ::YARD::Tags::Library.define_tag('Body parameter', :body_parameter) ::YARD::Tags::Library.define_tag('Parameter list', :parameter_list) ::YARD::Tags::Library.define_tag('Response class', :response_class) end - def get_doc + def get_doc(host) load! - @api.to_doc + doc = @api.to_doc + + doc['host'] = host if doc['host'].blank? + + doc end private def load! @@ -69,16 +73,18 @@ def parse_models parser = Parsers::Models.new definitions =[] - Dir[configuration.models_path].each do |file| - yard_objects = get_yard_objects(file) + configuration.models_paths.each do |path| + Dir[path].each do |file| + yard_objects = get_yard_objects(file) - definitions.concat(parser.run(yard_objects)) - end + definitions.concat(parser.run(yard_objects)) + end - @api.definitions = definitions + @api.definitions = definitions + end end def get_yard_objects(file) ::YARD.parse(file) yard_objects = ::YARD::Registry.all