Class: HOM::Element
- Inherits:
-
Object
- Object
- HOM::Element
- Defined in:
- lib/hom.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#tag_name ⇒ Object
readonly
Returns the value of attribute tag_name.
Instance Method Summary collapse
- #content? ⇒ Boolean
- #html_safe? ⇒ Boolean
-
#initialize(tag_name, attributes = nil, content = Undefined) ⇒ Element
constructor
A new instance of Element.
- #to_s ⇒ Object
Constructor Details
#initialize(tag_name, attributes = nil, content = Undefined) ⇒ Element
Returns a new instance of Element.
33 34 35 |
# File 'lib/hom.rb', line 33 def initialize(tag_name, attributes = nil, content = Undefined) @tag_name, @attributes, @content = tag_name, AttributeList.new.update(attributes), content end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
31 32 33 |
# File 'lib/hom.rb', line 31 def attributes @attributes end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
31 32 33 |
# File 'lib/hom.rb', line 31 def content @content end |
#tag_name ⇒ Object (readonly)
Returns the value of attribute tag_name.
31 32 33 |
# File 'lib/hom.rb', line 31 def tag_name @tag_name end |
Instance Method Details
#html_safe? ⇒ Boolean
41 42 43 |
# File 'lib/hom.rb', line 41 def html_safe? true end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/hom.rb', line 45 def to_s Encoding.safe_encode(self) end |