Sha256: 081190b237280a486cc0f9e1fce85389a90bd0ac8a4ea5977cba3c39d4e32039
Contents?: true
Size: 1.26 KB
Versions: 14
Compression:
Stored size: 1.26 KB
Contents
# Copyright (c) 2020 Jerome Arbez-Gindre # frozen_string_literal: true require('aasm') module DefMastership # DefMastership definition: contains all data of a definition class DefinitionParser include AASM def initialize(document) @document = document end aasm do state :idle, initial: true state :wait_content state :in_block state :single_para event :new_definition do transitions from: :idle, to: :wait_content, after: ->(*args) { @document.add_new_definition(*args) } end event :block_delimiter do transitions from: :wait_content, to: :in_block transitions from: %i[in_block idle single_para], to: :idle end event :new_line do transitions from: %i[wait_content single_para], to: :single_para, after: ->(*args) { @document.add_line(*args) } transitions from: :in_block, to: :in_block, after: ->(*args) { @document.add_line(*args) } transitions from: :idle, to: :idle end event :empty_line do transitions from: %i[wait_content single_para idle], to: :idle transitions from: :in_block, to: :in_block end end end end
Version data entries
14 entries across 14 versions & 1 rubygems