Class: Strling::Core::Esc
Overview
Represents a standalone escape sequence (e.g. d, w, s).
Instance Attribute Summary collapse
-
#property ⇒ String?
The Unicode property name (for p and P).
-
#type ⇒ String
The escape type (d, D, w, W, s, S, p, P).
Instance Method Summary collapse
-
#initialize(type, property: nil) ⇒ Esc
constructor
A new instance of Esc.
- #to_dict ⇒ Object
Constructor Details
#initialize(type, property: nil) ⇒ Esc
Returns a new instance of Esc.
193 194 195 196 |
# File 'lib/strling/core/nodes.rb', line 193 def initialize(type, property: nil) @type = type @property = property end |
Instance Attribute Details
#property ⇒ String?
Returns The Unicode property name (for p and P).
189 190 191 |
# File 'lib/strling/core/nodes.rb', line 189 def property @property end |
#type ⇒ String
Returns The escape type (d, D, w, W, s, S, p, P).
186 187 188 |
# File 'lib/strling/core/nodes.rb', line 186 def type @type end |
Instance Method Details
#to_dict ⇒ Object
198 199 200 201 202 |
# File 'lib/strling/core/nodes.rb', line 198 def to_dict data = { 'kind' => 'Esc', 'type' => type } data['property'] = property if %w[p P].include?(type) && property data end |