Class: Docbook::Services::NumberingService
- Inherits:
-
Object
- Object
- Docbook::Services::NumberingService
- Defined in:
- lib/docbook/services/numbering_service.rb
Constant Summary collapse
- SCOPED_COUNTER_ROLES =
%i[figure example table].freeze
- ROLE_HANDLERS =
{ part: :process_part, chapter: :process_chapter, appendix: :process_appendix, section: :process_section, }.freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(document) ⇒ NumberingService
constructor
A new instance of NumberingService.
Constructor Details
#initialize(document) ⇒ NumberingService
Returns a new instance of NumberingService.
15 16 17 18 19 20 21 22 23 |
# File 'lib/docbook/services/numbering_service.rb', line 15 def initialize(document) @document = document @numbering = [] @part_counter = 0 @chapter_counters = {} @appendix_counter = 0 @section_counters = {} @scoped_counters = { figure: {}, example: {}, table: {} } end |
Instance Method Details
#generate ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/docbook/services/numbering_service.rb', line 25 def generate @numbering = [] @part_counter = 0 @chapter_counters = {} @appendix_counter = 0 @section_counters = {} @scoped_counters = { figure: {}, example: {}, table: {} } process(@document) @numbering end |