Class: HamdownCore::Ast::Element
- Inherits:
-
Struct
- Object
- Struct
- HamdownCore::Ast::Element
- Includes:
- HasChildren
- Defined in:
- lib/hamdown_core/ast.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#lineno ⇒ Object
Returns the value of attribute lineno.
-
#new_attributes ⇒ Object
Returns the value of attribute new_attributes.
-
#nuke_inner_whitespace ⇒ Object
Returns the value of attribute nuke_inner_whitespace.
-
#nuke_outer_whitespace ⇒ Object
Returns the value of attribute nuke_outer_whitespace.
-
#object_ref ⇒ Object
Returns the value of attribute object_ref.
-
#old_attributes ⇒ Object
Returns the value of attribute old_attributes.
-
#oneline_child ⇒ Object
Returns the value of attribute oneline_child.
-
#self_closing ⇒ Object
Returns the value of attribute self_closing.
-
#static_class ⇒ Object
Returns the value of attribute static_class.
-
#static_id ⇒ Object
Returns the value of attribute static_id.
-
#tag_name ⇒ Object
Returns the value of attribute tag_name.
Instance Method Summary collapse
-
#attributes ⇒ Object
XXX: For compatibility.
-
#initialize ⇒ Element
constructor
A new instance of Element.
- #to_h ⇒ Object
Methods included from HasChildren
Constructor Details
#initialize ⇒ Element
Returns a new instance of Element.
51 52 53 54 55 56 57 58 |
# File 'lib/hamdown_core/ast.rb', line 51 def initialize(*) super self.static_class ||= '' self.static_id ||= '' self.self_closing ||= false self.nuke_inner_whitespace ||= false self.nuke_outer_whitespace ||= false end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def children @children end |
#filename ⇒ Object
Returns the value of attribute filename
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def filename @filename end |
#lineno ⇒ Object
Returns the value of attribute lineno
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def lineno @lineno end |
#new_attributes ⇒ Object
Returns the value of attribute new_attributes
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def new_attributes @new_attributes end |
#nuke_inner_whitespace ⇒ Object
Returns the value of attribute nuke_inner_whitespace
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def nuke_inner_whitespace @nuke_inner_whitespace end |
#nuke_outer_whitespace ⇒ Object
Returns the value of attribute nuke_outer_whitespace
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def nuke_outer_whitespace @nuke_outer_whitespace end |
#object_ref ⇒ Object
Returns the value of attribute object_ref
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def object_ref @object_ref end |
#old_attributes ⇒ Object
Returns the value of attribute old_attributes
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def old_attributes @old_attributes end |
#oneline_child ⇒ Object
Returns the value of attribute oneline_child
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def oneline_child @oneline_child end |
#self_closing ⇒ Object
Returns the value of attribute self_closing
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def self_closing @self_closing end |
#static_class ⇒ Object
Returns the value of attribute static_class
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def static_class @static_class end |
#static_id ⇒ Object
Returns the value of attribute static_id
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def static_id @static_id end |
#tag_name ⇒ Object
Returns the value of attribute tag_name
34 35 36 |
# File 'lib/hamdown_core/ast.rb', line 34 def tag_name @tag_name end |
Instance Method Details
#attributes ⇒ Object
XXX: For compatibility
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/hamdown_core/ast.rb', line 68 def attributes attrs = old_attributes || '' if new_attributes if attrs.empty? attrs = new_attributes else attrs += ", #{new_attributes}" end end attrs end |
#to_h ⇒ Object
60 61 62 63 64 65 |
# File 'lib/hamdown_core/ast.rb', line 60 def to_h super.merge( type: 'element', oneline_child: oneline_child && oneline_child.to_h, ) end |