Class: Coradoc::Parser::Asciidoc::Base

Inherits:
Parslet::Parser
  • Object
show all
Includes:
Admonition, AttributeList, Bibliography, Block, Citation, Content, DocumentAttributes, Header, Inline, List, Paragraph, Section, Table, Term, Text
Defined in:
lib/coradoc/parser/asciidoc/base.rb

Direct Known Subclasses

Base

Instance Method Summary collapse

Methods included from Text

#attr_name, #block_image, #comment_block, #comment_line, #date, #digit, #digits, #email, #empty_line, #endline, #eof?, #file_path, #include_directive, #inline_image, #keyword, #line_end, #line_ending, #line_start?, #newline, #newline_single, #rich_text, #rich_texts, #space, #space?, #special_character, #tag, #text, #word, #words

Methods included from Term

#term, #term2, #term_type

Methods included from Table

#cell_content, #empty_cell_content, #table, #table_row

Methods included from Section

#contents, #section, #section_block, #section_id, #section_title

Methods included from Paragraph

#line_not_text?, #paragraph, #paragraph_attributes, #paragraph_text_line

Methods included from List

#definition_list, #dlist_definition, #dlist_delimiter, #dlist_item, #dlist_term, #list, #list_continuation, #list_marker, #olist_item, #olist_marker, #ordered_list, #ulist_item, #ulist_marker, #unordered_list

Methods included from Inline

#bold_constrained, #bold_unconstrained, #highlight_constrained, #highlight_unconstrained, #italic_constrained, #italic_unconstrained, #text_formatted, #text_unformatted

Methods included from Header

#author, #header, #header_title, #revision

Methods included from DocumentAttributes

#attribute_name, #attribute_value, #document_attribute, #document_attributes

Methods included from Content

#asciidoc_char, #asciidoc_char_with_id, #glossaries, #glossary, #highlight, #highlight_text, #list_prefix, #literal_space, #literal_space?, #section_prefix, #text_id, #text_line, #underline

Methods included from Citation

#citation, #citation_noxref, #citation_xref, #cross_reference, #xref_anchor, #xref_arg, #xref_str

Methods included from Block

#block, #block_content, #block_delimiter, #block_id, #block_style, #block_title, #block_type, #example_block, #pass_block, #quote_block, #sidebar_block, #source_block

Methods included from Bibliography

#bib_entry, #bibliography

Methods included from AttributeList

#attribute_list, #named_attribute, #named_attribute_name, #named_attribute_value, #named_key, #named_many, #positional_attribute, #positional_many, #positional_many_named_many, #positional_one_named_many, #positional_zero_or_one

Methods included from Admonition

#admonition_line, #admonition_type

Instance Method Details

#rule_dispatch(rule_name, *args, **kwargs) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/coradoc/parser/asciidoc/base.rb', line 41

def rule_dispatch(rule_name, *args, **kwargs)
  @dispatch_data = {} unless @dispatch_data
  dispatch_key = [rule_name, args, kwargs.to_a.sort]
  dispatch_hash = dispatch_key.hash.abs
  unless @dispatch_data.has_key?(dispatch_hash)
    alias_name = "#{rule_name}_#{dispatch_hash}".to_sym
    Coradoc::Parser::Asciidoc::Base.class_exec do
      rule(alias_name) do
        send(rule_name, *args, **kwargs)
      end
    end
    @dispatch_data[dispatch_hash] = alias_name
  end
  dispatch_method = @dispatch_data[dispatch_hash]
  send(dispatch_method)
end