Class: HOM::NodeList
- Inherits:
-
Object
- Object
- HOM::NodeList
- Defined in:
- lib/hom.rb
Instance Method Summary collapse
- #+(object) ⇒ Object
- #html_safe? ⇒ Boolean
-
#initialize(nodes) ⇒ NodeList
constructor
A new instance of NodeList.
- #join(separator) ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(nodes) ⇒ NodeList
Returns a new instance of NodeList.
51 52 53 |
# File 'lib/hom.rb', line 51 def initialize(nodes) @nodes = Array(nodes) end |
Instance Method Details
#+(object) ⇒ Object
67 68 69 |
# File 'lib/hom.rb', line 67 def +(object) self.class.new(@nodes + Array(object)) end |
#html_safe? ⇒ Boolean
55 56 57 |
# File 'lib/hom.rb', line 55 def html_safe? true end |
#join(separator) ⇒ Object
71 72 73 |
# File 'lib/hom.rb', line 71 def join(separator) Encoding.safe_encode(intersperse(separator, @nodes)) end |
#to_a ⇒ Object
63 64 65 |
# File 'lib/hom.rb', line 63 def to_a @nodes end |
#to_s ⇒ Object
59 60 61 |
# File 'lib/hom.rb', line 59 def to_s Encoding.safe_encode(self) end |