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.
59 60 61 |
# File 'lib/hom.rb', line 59 def initialize(nodes) @nodes = Array(nodes) end |
Instance Method Details
#+(object) ⇒ Object
75 76 77 |
# File 'lib/hom.rb', line 75 def +(object) self.class.new(@nodes + Array(object)) end |
#html_safe? ⇒ Boolean
63 64 65 |
# File 'lib/hom.rb', line 63 def html_safe? true end |
#join(separator) ⇒ Object
79 80 81 |
# File 'lib/hom.rb', line 79 def join(separator) self.class.new(intersperse(separator, @nodes)) end |
#to_a ⇒ Object
71 72 73 |
# File 'lib/hom.rb', line 71 def to_a @nodes end |
#to_s ⇒ Object
67 68 69 |
# File 'lib/hom.rb', line 67 def to_s Encoding.safe_encode(self) end |