Method: Fdoc::ServicePresenter#endpoints

Defined in:
lib/fdoc/presenters/service_presenter.rb

#endpointsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fdoc/presenters/service_presenter.rb', line 36

def endpoints
  if !@endpoints
    @endpoints = []
    prefix = nil

    service.endpoints.sort_by(&:endpoint_path).each do |endpoint|
      presenter = Fdoc::EndpointPresenter.new(endpoint, options)
      presenter.service_presenter = self
      presenter

      current_prefix = presenter.prefix

      @endpoints << [] if prefix != current_prefix
      @endpoints.last << presenter

      prefix = current_prefix
    end
  end

  @endpoints
end