Class: Apress::Documentation::Storage::Document

Inherits:
BaseStorage
  • Object
show all
Includes:
Dsl::Document
Defined in:
lib/apress/documentation/storage/document.rb

Overview

Protected

Внутренний класс системы документации Описывает отдельный документ

Instance Attribute Summary

Attributes inherited from BaseStorage

#slug

Instance Method Summary collapse

Methods included from Dsl::Document

#compile

Methods inherited from BaseStorage

#as_json, #assign, #dependencies, #eql?, #hash, #inspect, json_attr, json_attr_names, #to_s

Constructor Details

#initialize(slug) ⇒ Document

Returns a new instance of Document.



24
25
26
# File 'lib/apress/documentation/storage/document.rb', line 24

def initialize(slug)
  @slug = slug
end

Instance Method Details

#current_moduleObject

Public: находит документ верхнего уровня - модуль

Returns Document



46
47
48
# File 'lib/apress/documentation/storage/document.rb', line 46

def current_module
  Apress::Documentation::Storage::Modules.instance[slug.to_s.split('/').first]
end

#documentsObject

Public: Хранит дочерние документы



34
35
36
# File 'lib/apress/documentation/storage/document.rb', line 34

def documents
  @documents ||= {}
end

#swagger?Boolean

Public: проверка, необходимо ли для данного документа отображать SwaggerUI

Returns:

  • (Boolean)


29
30
31
# File 'lib/apress/documentation/storage/document.rb', line 29

def swagger?
  !swagger_documents.empty?
end

#swagger_documentsObject

Public: Хранит объекты SwaggerDocument для отображения на одной старнице через SwaggerUI



39
40
41
# File 'lib/apress/documentation/storage/document.rb', line 39

def swagger_documents
  @swagger_documents ||= {}
end