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

#footnote, #term, #term_inline, #term_inline2, #term_type

Methods included from Table

#cell_content, #empty_cell_content, #table, #table_row

Methods included from Section

#contents, #section, #section_block, #section_prefix, #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

#attribute_reference, #bold_constrained, #bold_unconstrained, #highlight_constrained, #highlight_unconstrained, #inline, #inline_chars?, #inline_image, #italic_constrained, #italic_unconstrained, #link, #monospace_constrained, #monospace_unconstrained, #small, #span, #span_constrained, #span_unconstrained, #subscript, #superscript, #text_any, #text_formatted, #text_unformatted, #underline

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, #element_id, #element_id_inline, #glossaries, #glossary, #list_prefix, #literal_space, #literal_space?, #text_line

Methods included from Citation

#cross_reference, #xref_anchor, #xref_arg, #xref_str

Methods included from Block

#block, #block_content, #block_delimiter, #block_style, #block_title, #block_type, #element_attributes, #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_key, #named_many, #named_value, #named_value_double_quote, #named_value_noquote, #named_value_single_quote, #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



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

def rule_dispatch(rule_name, *args, **kwargs)
  @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