145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
# File 'lib/betterdocs/global.rb', line 145
def all_docs
Dir.chdir controllers_dir do
Dir["#{api_prefix}/**/*_controller.rb"].each_with_object([]) do |cf, all|
controller_name = cf.sub(/\.rb$/, '').camelcase
controller =
begin
controller_name.constantize
rescue NameError => e
STDERR.puts "Skipping #{cf.inspect}, #{e.class}: #{e}"
next
end
if docs = controller.ask_and_send(:docs)
all << docs
else
STDERR.puts "Skipping #{cf.inspect}, #{controller_name.inspect} doesn't respond to :docs method"
end
end
end
end
|