Module: SwaggerCodegenRails::Konstants
- Includes:
- Base
- Defined in:
- lib/swagger_codegen_rails/konstants.rb
Defined Under Namespace
Classes: Konstant
Instance Method Summary
collapse
Methods included from Base
#concern_dir, #schema_dir
Instance Method Details
#base_path(type) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/swagger_codegen_rails/konstants.rb', line 16
def base_path(type)
case type
when :controller
concern_dir
when :model
schema_dir
else
raise ArgumentError
end
rescue ArgumentError => e
puts "ArgumentError (not in [:controller, :model])"
end
|
#find_from_path(source, match) ⇒ Object
12
13
14
|
# File 'lib/swagger_codegen_rails/konstants.rb', line 12
def find_from_path(source, match)
Dir.glob(File.join(source, match))
end
|
#include_swagger(dir, type: :controller) ⇒ Object
6
7
8
9
10
|
# File 'lib/swagger_codegen_rails/konstants.rb', line 6
def include_swagger(dir, type: :controller)
find_from_path(dir, "/**/*.rb").each do |path|
include Konstant.new(path, base_path(type)).specify!
end
end
|