Class: Undies::Element::Closed
- Inherits:
-
Object
- Object
- Undies::Element::Closed
- Includes:
- CSSProxy, MergeAttrs
- Defined in:
- lib/undies/element.rb
Constant Summary
Constants included from CSSProxy
Undies::Element::CSSProxy::CLASS_METH_REGEX, Undies::Element::CSSProxy::ID_METH_REGEX
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#__build ⇒ Object
closed elements should have no build so do nothing.
-
#__content ⇒ Object
closed elements have no content.
-
#__end_tag ⇒ Object
closed elements have no end tag.
- #__start_tag ⇒ Object
-
#initialize(name, attrs = {}) ⇒ Closed
constructor
A new instance of Closed.
- #to_s ⇒ Object
-
#to_str(*args) ⇒ Object
(also: #inspect)
overriding this because the base Node class defines a ‘to_s’ method that needs to be honored.
Methods included from MergeAttrs
Methods included from CSSProxy
Constructor Details
#initialize(name, attrs = {}) ⇒ Closed
Returns a new instance of Closed.
140 141 142 143 144 |
# File 'lib/undies/element.rb', line 140 def initialize(name, attrs={}) @name = name.to_s @attrs = {} proxy([attrs]) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Undies::Element::CSSProxy
Instance Method Details
#==(other) ⇒ Object
163 164 165 166 |
# File 'lib/undies/element.rb', line 163 def ==(other) other.instance_variable_get("@name") == @name && other.instance_variable_get("@attrs") == @attrs end |
#__build ⇒ Object
closed elements should have no build so do nothing
154 |
# File 'lib/undies/element.rb', line 154 def __build; end |
#__content ⇒ Object
closed elements have no content
151 |
# File 'lib/undies/element.rb', line 151 def __content; ''; end |
#__end_tag ⇒ Object
closed elements have no end tag
157 |
# File 'lib/undies/element.rb', line 157 def __end_tag; ''; end |
#__start_tag ⇒ Object
146 147 148 |
# File 'lib/undies/element.rb', line 146 def __start_tag "<#{@name}#{Undies::Element.hash_attrs(@attrs)} />" end |
#to_s ⇒ Object
159 160 161 |
# File 'lib/undies/element.rb', line 159 def to_s Undies::Raw.new("#{__start_tag}") end |
#to_str(*args) ⇒ Object Also known as: inspect
overriding this because the base Node class defines a ‘to_s’ method that needs to be honored
170 171 172 173 |
# File 'lib/undies/element.rb', line 170 def to_str(*args) "Undies::Element::Closed:#{self.object_id} " + "@name=#{@name.inspect}, @attrs=#{@attrs.inspect}" end |