Method: Fdoc::Service#path_for

Defined in:
lib/fdoc/service.rb

#path_for(verb, path) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fdoc/service.rb', line 66

def path_for(verb, path)
  flat_path   = File.join(@service_dir, "#{path}-#{verb.to_s.upcase}.fdoc")
  nested_path = File.join(@service_dir, "#{path}/#{verb.to_s.upcase}.fdoc")

  if File.exist?(flat_path)
    flat_path
  elsif File.exist?(nested_path)
    nested_path
  else # neither exists, default to flat_path
    flat_path
  end
end