Class: RicherText::Mark
- Inherits:
-
Object
- Object
- RicherText::Mark
- Defined in:
- lib/richer_text/mark.rb
Constant Summary collapse
- TAGS =
{ "bold" => "strong", "italic" => "em", "strike" => "del", "code" => "code", "highlight" => "mark", "link" => "a" }
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(json) ⇒ Mark
constructor
A new instance of Mark.
- #tag ⇒ Object
Constructor Details
#initialize(json) ⇒ Mark
Returns a new instance of Mark.
14 15 16 17 |
# File 'lib/richer_text/mark.rb', line 14 def initialize(json) @attrs = json.fetch("attrs", {}) @type = json.fetch("type", nil) end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
3 4 5 |
# File 'lib/richer_text/mark.rb', line 3 def attrs @attrs end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/richer_text/mark.rb', line 3 def type @type end |
Instance Method Details
#tag ⇒ Object
19 20 21 |
# File 'lib/richer_text/mark.rb', line 19 def tag TAGS[type] || "span" end |