Class: TreeHaver::Backends::Commonmarker::Language
- Inherits:
-
Object
- Object
- TreeHaver::Backends::Commonmarker::Language
- Includes:
- Comparable
- Defined in:
- lib/tree_haver/backends/commonmarker.rb
Overview
Commonmarker language wrapper
Commonmarker only parses Markdown. This class exists for API compatibility.
Instance Attribute Summary collapse
-
#backend ⇒ Symbol
readonly
The backend this language is for.
-
#name ⇒ Symbol
readonly
The language name (always :markdown for Commonmarker).
-
#options ⇒ Hash
readonly
Commonmarker parse options.
Class Method Summary collapse
-
.markdown(options: {}) ⇒ Language
Create a Markdown language instance.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Comparison for sorting/equality.
-
#initialize(name = :markdown, options: {}) ⇒ Language
constructor
Create a new Commonmarker language instance.
- #inspect ⇒ Object
Constructor Details
#initialize(name = :markdown, options: {}) ⇒ Language
Create a new Commonmarker language instance
91 92 93 94 95 |
# File 'lib/tree_haver/backends/commonmarker.rb', line 91 def initialize(name = :markdown, options: {}) @name = name.to_sym @backend = :commonmarker = end |
Instance Attribute Details
#backend ⇒ Symbol (readonly)
The backend this language is for
81 82 83 |
# File 'lib/tree_haver/backends/commonmarker.rb', line 81 def backend @backend end |
#name ⇒ Symbol (readonly)
The language name (always :markdown for Commonmarker)
77 78 79 |
# File 'lib/tree_haver/backends/commonmarker.rb', line 77 def name @name end |
#options ⇒ Hash (readonly)
Commonmarker parse options
85 86 87 |
# File 'lib/tree_haver/backends/commonmarker.rb', line 85 def end |
Class Method Details
.markdown(options: {}) ⇒ Language
Create a Markdown language instance
102 103 104 |
# File 'lib/tree_haver/backends/commonmarker.rb', line 102 def markdown(options: {}) new(:markdown, options: ) end |
Instance Method Details
#<=>(other) ⇒ Object
Comparison for sorting/equality
108 109 110 111 |
# File 'lib/tree_haver/backends/commonmarker.rb', line 108 def <=>(other) return unless other.is_a?(Language) name <=> other.name end |
#inspect ⇒ Object
113 114 115 |
# File 'lib/tree_haver/backends/commonmarker.rb', line 113 def inspect "#<TreeHaver::Backends::Commonmarker::Language name=#{name} options=#{options}>" end |