Class: Prosereflect::HorizontalRule
- Inherits:
-
Node
- Object
- Lutaml::Model::Serializable
- Node
- Prosereflect::HorizontalRule
show all
- Defined in:
- lib/prosereflect/horizontal_rule.rb
Overview
HorizontalRule class represents a horizontal rule in ProseMirror.
Constant Summary
collapse
- PM_TYPE =
'horizontal_rule'
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Node
#find_all, #find_children, #find_first, #marks, #marks=, #parse_content, #process_attrs_data, #raw_marks, #text_content, #to_h, #to_yaml
Constructor Details
#initialize(attributes = {}) ⇒ HorizontalRule
Returns a new instance of HorizontalRule.
22
23
24
25
|
# File 'lib/prosereflect/horizontal_rule.rb', line 22
def initialize(attributes = {})
attributes[:content] = []
super
end
|
Class Method Details
.create(attrs = nil) ⇒ Object
27
28
29
|
# File 'lib/prosereflect/horizontal_rule.rb', line 27
def self.create(attrs = nil)
new(attrs: attrs)
end
|
Instance Method Details
#add_child ⇒ Object
Override content-related methods since horizontal rules don’t have content
62
63
64
|
# File 'lib/prosereflect/horizontal_rule.rb', line 62
def add_child(*)
raise NotImplementedError, 'Horizontal rule nodes cannot have children'
end
|
#content ⇒ Object
66
67
68
|
# File 'lib/prosereflect/horizontal_rule.rb', line 66
def content
[]
end
|
#style ⇒ Object
37
38
39
|
# File 'lib/prosereflect/horizontal_rule.rb', line 37
def style
@style || attrs&.[]('style')
end
|
#style=(value) ⇒ Object
31
32
33
34
35
|
# File 'lib/prosereflect/horizontal_rule.rb', line 31
def style=(value)
@style = value
self.attrs ||= {}
attrs['style'] = value
end
|
#thickness ⇒ Object
57
58
59
|
# File 'lib/prosereflect/horizontal_rule.rb', line 57
def thickness
@thickness || attrs&.[]('thickness')
end
|
#thickness=(value) ⇒ Object
51
52
53
54
55
|
# File 'lib/prosereflect/horizontal_rule.rb', line 51
def thickness=(value)
@thickness = value
self.attrs ||= {}
attrs['thickness'] = value
end
|
#width ⇒ Object
47
48
49
|
# File 'lib/prosereflect/horizontal_rule.rb', line 47
def width
@width || attrs&.[]('width')
end
|
#width=(value) ⇒ Object
41
42
43
44
45
|
# File 'lib/prosereflect/horizontal_rule.rb', line 41
def width=(value)
@width = value
self.attrs ||= {}
attrs['width'] = value
end
|