Class: Docbook::Mirror::Mark::Code
- Inherits:
-
Base
- Object
- Docbook::Mirror::Mark
- Base
- Docbook::Mirror::Mark::Code
- Defined in:
- lib/docbook/mirror/mark.rb,
lib/docbook/mirror/mark/code.rb
Overview
Code mark with role attribute to distinguish DocBook code types:
- literal:
- code:
- userinput:
- computeroutput:
- filename:
- classname:
- function:
- parameter:
- replaceable:
Constant Summary collapse
- PM_TYPE =
"code"
Constants inherited from Docbook::Mirror::Mark
Instance Attribute Summary
Attributes inherited from Docbook::Mirror::Mark
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(role: "literal") ⇒ Code
constructor
A new instance of Code.
- #role ⇒ Object
- #role=(value) ⇒ Object
Methods inherited from Docbook::Mirror::Mark
Constructor Details
#initialize(role: "literal") ⇒ Code
Returns a new instance of Code.
69 70 71 72 |
# File 'lib/docbook/mirror/mark.rb', line 69 def initialize(role: "literal", **) super(**) @attrs[:role] = role end |
Class Method Details
.from_h(hash) ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/docbook/mirror/mark.rb', line 78 def self.from_h(hash) return nil unless hash attrs = hash["attrs"] || {} role = attrs[:role] || attrs["role"] || "literal" new(role: role) end |
Instance Method Details
#role ⇒ Object
74 75 76 |
# File 'lib/docbook/mirror/mark.rb', line 74 def role @attrs[:role] end |
#role=(value) ⇒ Object
30 31 32 |
# File 'lib/docbook/mirror/mark/code.rb', line 30 def role=(value) @attrs[:role] = value end |